Second what Rich said, keep replies to the list, please. This can benifit everyone.
---John Holmes... ----- Original Message ----- From: "John W. Holmes" <[EMAIL PROTECTED]> To: "Ryan A" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, March 24, 2004 1:22 PM Subject: Re: [PHP] looping variables from a file > From: "Ryan A" <[EMAIL PROTECTED]> > > > I knew this would be complicated when I started to write to the list for > > help but didnt know so > > complicated....I can just about understand (barely) what you guys are > > telling me but dont know > > where to start..can you give me some starting code example/s which I can > > build on? > > Sure... > > $array1 = get_defined_vars(); > include('yourfile.php'); > $array2 = get_defined_vars(); > > $newvars = array_diff($array2,$array1); > foreach($newvars as $name => $value) > { echo "$name = <font color=\"green\">$value</font><br />\n"; } > > Actually, if you said there were arrays inside the include file, it may get > a little more complicated. If they are one dimensional arrays, you can test > $value with is_array() and maybe implode() the values into a string to > display. > > if(is_array($value)) > { echo implode(',',$value); } > else > { echo $value; } > > If there are multi-dimensional arrays, then you'll need a recursive > function. Have fun! > > ---John Holmes... > > PS: This is all assuming the user comments are correct and variables from > include()'d files are captured by get_defined_vars(). > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php