Re: Function proposal

From: Date: Mon, 16 May 2005 14:16:03 +0000
Subject: Re: Function proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-16254@lists.php.net to get a copy of this message
Hmm, it's no GOTO, but oddly enough we have virtually exactly the same function and use it everywhere too. The only differences are we call ours pre_r() and we add the following check against php_sapi_name() so that the function behaves sanely when called from the cli: function pre_r($mixed, $return) { if ( php_sapi_name() == "cli" ) { if ( $return ) return print_r($mixed, true); print_r($mixed); } else { if ( $return ) return "<pre>" . print_r($mixed, true) . "</pre>"; echo "<pre>"; print_r($mixed); echo "</pre>"; } } While I don't know if it *needs* to be in the core, if it were I'd certainly use it. My $0.02, Benj Carson

« previous php.internals (#16254) next »