Re: note 28317 added to reserved.variables

From: Date: Thu, 09 Jan 2003 06:16:50 +0000
Subject: Re: note 28317 added to reserved.variables
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41887@lists.php.net to get a copy of this message
Wow a version almost 2 1/4 years old. Talk about archeology. Added a comment to your note mentioning that the bug was fixed long ago. BTW, what was not clear in the form you used to submit your contribution in the part that says: "... There is no need to obsfuscate your email address, as we have a simple conversion in place to convert the @ signs and dots in your address. You may still want to include a part in the email address only understandable by humans, to make it spam protected, as our conversion can be performed the other way too. You may submit your email address as user@NOSPAM.example.com for example (which will be displayed as user at NOSPAM dot example dot com. Although note that we can only inform you of the removal of your note, if you use your real email address. ..." You made it not easy to find your correct email address. Let me know if you rather have your note removed. --- jlsalinas@rack1.php.net, INVALID_ADDRESS@.SYNTAX-ERROR. wrote: > When using print_r() to see the contents of > $GLOBALS, it falls in an infinite loop, because > $GLOBALS contains itself. I don't know why, but it's > this way. at least with PHP 4.0.2. > In order to avoid this infinite loop, I've created a > function that recursively prints any kind of > variable, stopping if it founds a nested variable > with the same name (it's configurable, though). > You have to call it with the variable you want to > inspect, and (optionally) the name of the variable. > When the name is specified, the function looks for > loops; when not, it will go on forever. > Before using this code, replace every "<_br_>" with > "<", "br" and ">", you know ;) . > > <?php > function show_var ($var, $name = '', $ident = 0) { > $spc = $ident > 0 ? str_repeat > ('&nbsp;&nbsp;&nbsp;', $ident ) : ''; > > $out = ''; > if (is_array ($var)) { > $out .= "Array (<_br_>\n"; > foreach ($var as $key => $val) { > $out .= "$spc&nbsp;&nbsp;" . "[$key] => "; > $out .= ($key == $name) ? "LOOP<_br_>\n" : > show_var ($val, $name != '' ? $key : '', $ident + > 1); > } > $out .= "$spc)<_br_>\n"; > } else if (is_object ($var)) { > $clase = get_class ($var); > $parent = get_parent_class ($var); > $out .= "Object [class $clase"; > $out .= $parent != '' ? "extends $parent" : ''; > $out .= "] (<_br_>\n"; > $arr = get_object_vars ($var); > while (list($prop, $val) = each($arr)) { > $out .= "$spc&nbsp;&nbsp;" . "->$prop = "; > $out .= show_var ($val, $name != '' ? $prop : '', > $ident + 1); > } > $out .= "$spc)<_br_>\n"; > } else if (is_resource ($var)) { > $out .= "Resource ( " . $var . " )<_br_>\n"; > } else if (is_string ($var)) { > $out .= '"' . htmlspecialchars($var) . '"' . > "<_br_>\n"; > } else if (is_numeric ($var)) { > $out .= $var . "<_br_>\n"; > } else if (is_bool ($var)) { > $out .= ($var ? 'True' : 'False') . "<_br_>\n"; > } else if (is_null ($var)) { > $out .= "Null<_br_>\n"; > } else { > $out .= "Other ( " . $var . " )<_br_>\n"; > } > > return $out; > } > > echo show_var ($GLOBALS, 'GLOBALS'); > ?> > -- > http://www.php.net/manual/en/reserved.variables.php > http://master.php.net/manage/user-notes.php?action=edit+28317 > http://master.php.net/manage/user-notes.php?action=delete+28317 > http://master.php.net/manage/user-notes.php?action=reject+28317 > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.notes (#41887) next »