Edit report at https://bugs.php.net/bug.php?id=25874&edit=1

 ID:                 25874
 Updated by:         yohg...@php.net
 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:

> by the way: you have to check your emailvalidator ... it says my emailaddress 
is not valid (so now i used another one)

I have no idea what you're referring.
Create new report if it's new, or add comment to appropriate report.


Previous Comments:
------------------------------------------------------------------------
[2013-08-25 20:58:19] yohg...@php.net

Check documentation. Trailing comma is allowed in PHP.
Comma is there for simplicity. Try to write your own, then you'll see.

It's easy to write code, easy to add additional element.

------------------------------------------------------------------------
[2013-08-25 18:52:17] paulwolbers at home dot nl

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)

------------------------------------------------------------------------
[2003-10-14 23:04:47] il...@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

Reply via email to