How can a Bash parameter be passed to a PHP script using shell_exec?

To pass a Bash parameter to a PHP script using shell_exec, you can concatenate the parameter to the command string that is passed to shell_exec. For example, if you want to pass a parameter called "param1" to your PHP script, you can include it in the command string like this: "php script.php param1". In the PHP script, you can access this parameter using the $argv array.

<?php
$param = escapeshellarg($argv[1]);
$result = shell_exec("php script.php $param");
echo $result;
?>