fork(2) download
  1. <?php
  2.  
  3. function debug($var_name, $scope_vars=null) {
  4. if ($scope_vars === null) {
  5. $scope_vars = $GLOBALS;
  6. };
  7. printf('%s value is %s', $var_name, var_export($scope_vars[$var_name], true));
  8. }
  9.  
  10. $testvar1 = 'ABCDEF';
  11. debug('testvar1');
  12.  
  13. echo PHP_EOL;
  14.  
  15. function testfunc2() {
  16. $testvar2 = 'GHIJKL';
  17. debug('testvar2', get_defined_vars());
  18. }
  19. testfunc2();
  20.  
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
testvar1 value is 'ABCDEF'
testvar2 value is 'GHIJKL'