note 98146 modified in function.get-defined-vars by thiago

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
For debugging I use following function:

<?php
function showVars($vars, $return=0) {
    $out=array();
    if(!is_array($vars)) $vars=array($vars);

    foreach($vars as $var) {
      $out[$var]=$GLOBALS[$var];
    }

    if($return==1) return $out;
    elseif($return==-1) var_dump($out);
    else print_r($out);
}
?>

Usage:

<?php
$foo=5;
$bar=10;

showVars(array('foo', 'bar'));
?>

--was--
RE: SyCo

For debugging I use following function:

function showVars($vars, $return=0) {
    $out=array();
    if(!is_array($vars)) $vars=array($vars);

    foreach($vars as $var) {
      $out[$var]=$GLOBALS[$var];
    }

    if($return==1) return $out;
    elseif($return==-1) var_dump($out);
    else print_r($out);
}

Usage:

$foo=5;
$bar=10;

showVars(array('foo', 'bar'));

http://php.net/manual/en/function.get-defined-vars.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.