Re: var_export() from PHP 4.2.0?
| From: | derick@php.net | Date: | Sat, 24 Aug 2002 10:22:07 +0000 |
| Subject: | Re: var_export() from PHP 4.2.0? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87393@lists.php.net to get a copy of this message | ||
On Sat, 24 Aug 2002, Yasuo Ohgaki wrote:
> I'm very suprised there is var_export() from PHP 4.2.0 that works
> just like var_dump()/print_r().
>
> If we keep doing this, there will be full of duplicated functions
> that do almost the same thing with a little different manner.
>
> Is there good reason to have this?
> Am I missing very useful var_export() only feature that
> cannot be integrated into var_dump()/print_r()?
It generates PHP parsable code, and modifying var_dump would not be
possible because var_export has less data that it outputs (no "resource
bla") things. And BTW, it was already in a released version, so removing
it now would break BC.
Derick
>
>
> [yohgaki@dev yohgaki]$ php
> <?php
> $a = array (1, 2, array ("a", "b", "c"));
> var_export ($a);
> echo "\n";
> var_dump($a);
> echo "\n";
> print_r($a);
> ?>
>
>
> array (
> 0 => 1,
> 1 => 2,
> 2 =>
> array (
> 0 => 'a',
> 1 => 'b',
> 2 => 'c',
> ),
> )
> array(3) {
> [0]=>
> int(1)
> [1]=>
> int(2)
> [2]=>
> array(3) {
> [0]=>
> string(1) "a"
> [1]=>
> string(1) "b"
> [2]=>
> string(1) "c"
> }
> }
>
> Array
> (
> [0] => 1
> [1] => 2
> [2] => Array
> (
> [0] => a
> [1] => b
> [2] => c
> )
>
> )
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
---------------------------------------------------------------------------
Did I help you? http://www.derickrethans.nl/link.php?url=giftlist
Frequent ranting: http://www.derickrethans.nl/
---------------------------------------------------------------------------
PHP: Scripting the Web - derick@php.net
All your branches are belong to me!
SRM: Script Running Machine - www.vl-srm.net
---------------------------------------------------------------------------