How does PHP handle single and double quotes differently when passing parameters to the exec() function?

PHP handles single and double quotes differently when passing parameters to the exec() function because double quotes allow for variable interpolation, while single quotes do not. To ensure that variables are properly passed as parameters to the exec() function, it is recommended to use double quotes around the command and escape any double quotes within the command with a backslash (\).

$param = "example";
$command = "echo \"$param\"";
exec($command);