Consider these two examples. The first as used in the manual, and the second a slight variation of it.
Example #1
<?php
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location_vars = array("city", "state");
$result = compact("event", $location_vars);
print_r($result);
?>
Example #1 above will output:
Array
(
[event] => SIGGRAPH
[city] => San Francisco
[state] => CA
)
Example #2
<?php
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";
$location_vars = array("city", "state");
$result = compact("event", "location_vars");
print_r($result);
?>
Example #2 above will output:
Array
(
[event] => SIGGRAPH
[location_vars] => Array
(
[0] => city
[1] => state
)
)
In the first example, the value of the variable $location_values (which is an array containing city, and state) is passed to compact().
In the second example, the name of the variable $location_vars (i.e without the '$' sign) is passed to compact() as a string. I hope this further clarifies the points made in the manual?