The easiest solution is to use referenced values. Even during assignment, if a non-existant reference is used, it will create it in the current scope without a warning. When a variable under the same name is later found it will use the already defined variable under that name:
Originally Posted by jasonc310771
Another solution is to put the PHP back together using eval().
$test = &$name;
$name = 'Jason';
printf("\$test = %s\n", $test);
I should mention, that in either case you could be walking into trouble. Should a referenced or eval'd variable be used and not explicitly defined, if register_globals are in use you've now created a gigantic security hole since users can enter their own variables for the replacement code. On the plus side, the client needs to know what the variables in use are, and if you've disabled error reporting than there shouldn't be any issues.