Bug #25874 [Com]: var_export does not output valid code
Edit report at https://bugs.php.net/bug.php?id=25874&edit=1
ID: 25874
Comment by: paulwolbers at home dot nl
Reported by: fire at firepages dot com dot au
Summary: var_export does not output valid code
Status: Not a bug
Type: Bug
Package: Variables related
Operating System: XP
PHP Version: 4.3.3
Block user comment: N
Private report: N
New Comment:
But why is the comma there? I don't want there because it looks like something's wrong
(even if it's correct behaviour)
by the way: you have to check your emailvalidator ... it says my emailaddress is not valid (so now i
used another one)
Previous Comments:
------------------------------------------------------------------------
[2003-10-14 23:04:47] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The trailing comma while unusual is perfectly valid and the code evaluates correctly.
------------------------------------------------------------------------
[2003-10-14 22:21:48] fire at firepages dot com dot au
Description:
------------
output from var_export($var,true) has trailing comma so you have to strip that manually before
utilising the returned string.
the manual example shows this behaviour so perhaps its a feature ?
Reproduce code:
---------------
$yaks = array( 'dfdf'=>'a' , 'b' , 'c' , 'd' )
;
echo '$llama = ' . var_export( $yaks , true ) . ' ;' ;
Expected result:
----------------
$llama = array ( 'dfdf' => 'a', 0 => 'b', 1 => 'c',
2 => 'd' ) ;
Actual result:
--------------
$llama = array ( 'dfdf' => 'a', 0 => 'b', 1 => 'c',
2 => 'd', ) ;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=25874&edit=1
Thread (5 messages)