get_defined_vars returns defined variables
Today in the #scriptschool chat we talked about how to get the current defined variables used in a script. Check out the following code which illustrates the use of get_defined_vars(). The variables set will be at the end of the output:
<?php
$myname = ‘TDavid’;
$mydomains = array(‘http://www.php-scripts.com’,‘http://www.tdscripts.com/’);
$arr = get_defined_vars();
echo ‘<pre>’;
var_dump($arr);
echo ”;
?>
This is particularly useful for keypoint checking/debugging.
