|
Posted by Ming on 08/17/07 17:05
On Aug 17, 10:03 am, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 17 Aug 2007 19:00:12 +0200, Ming <minghu...@gmail.com> wrote:
> > Very frequently, I need to use codes like this to see output clearly:
>
> > $a=print_r($var,true);
> > echo "<pre>$a</pre>";
>
> > How can convert this piece of code to a global function (for example:
> > echopre) in Php so that I can use echopre($data) anywhere in php
> > program (in my server)?
>
> Define the function somewhere? Functions are always in scope, there are no
> 'local' or 'global' functions. So just put this code somewhere in the
> beginning/in a functions-include file:
> <?php
> function echopre($a){
> $a=print_r($var,true);
> echo "<pre>$a</pre>";}
>
> ?>
> --
> Rik Wasmus
Thanks Rik.
I want to make it as a stand function come with php. i.e.: I want to
make it anywhere I can use echo.
Navigation:
[Reply to this message]
|