Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-callingVars

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  callingVars   Lines 191-244 (53 lines) file  utilsDebug.php   Last mod: Mon 2021-05-03 17:55:24

function callingVars $n=)
        {
#-k     debug   trace
#-      return array of variables passed in to the nth caller up the stack (callingVars itself is 0)
#-      Usage:
#-              dump ( callingVars(1) );
#-                      returns name, len, & contents of each variable
#-                      sent to the routine that 'dump' is in

        
$raw debug_backtrace();
#               load variable names
        
$ax[-1]['srch'] = 'function ' $raw[$n]['function'];   # my function name
        
$ax[-1]['file'] = $raw[$n-1]['file'];
        
$line file $ax[-1]['file'] );       # my file
        
$st $ax[-1]['srch'];
        
$ax[-1]['line'] = searchArray $st$line );
        
$ax[-1]['vars'] = $line[$ax[-1]['line']];
        
$p strpos $ax[-1]['vars'], '(' );
        
$parens trim(contentsParen $ax[-1]['vars'], $p ));
        
$ax[-1]['v'] = returnArgs $parens );                  # arguments on the def line
#       if (!isset($ax[-1]['v']))
#               {       # no args expected, or variable params allowed like eko & prtList.
#               $ax[-1]['v'][0] = $raw[1]['args'][0];
#               $ax[-1]['v'][1] = $raw[1]['args'][1];
#               $ax[-1]['v'][2] = $raw[1]['args'][2];
#               }
#exo ( $ax[-1]['v'] );

#               load data
        
$line file $raw[$n]['file'] );
        
$codeline trim($line[$raw[$n]['line']-1]);
        
$p strpos $codeline,'(' );
        
$parens trim(contentsParen $codeline$p ));
        if (
strlen($parens))
                {
                
$ar returnArgs $parens );                   # arguments on the calling line
#exo ( $raw );
#exo($parens);
#exo ( $ar );
                
for ($i=0;$i<count($ar);$i++)
                        {
                        
$p strpos '$'$ar[$i] );
                        
$ax[$i]['vnam'] = trim($ax[-1]['v'][$i]);
                        
$ax[$i]['name'] = substr($ar[$i],$p);
                        if ( 
is_array ($raw[$n]['args'][$i]))           { $ax[$i]['vlen'] = 'array';}
                        elseif ( 
is_string ($raw[$n]['args'][$i]))      { $ax[$i]['vlen'] = strlen($raw[$n]['args'][$i]); }
                        else                                            { 
$ax[$i]['vlen'] = is ( ($raw[$n]['args'][$i]) );}
                        
$ax[$i]['cont'] = $raw[$n]['args'][$i];
                        }
                }
        unset(
$ax[-1]);
        return 
$ax;
        }

?>