Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- problem with different versions of php
November 10, 2006, 6:04 am
rate this thread
I'm not sure where to look up the answer to this question myself, so
maybe you can help me.
The following line of code works fine with php5:
On a system with php4 the following error is thrown:
Parse error: parse error, unexpected '=', expecting ')' in <phpfile> on
Now I would like to know, what the problem is. Is it the '&' or the
default value assignment or a combination of both?
Where would I find documentation on the differences in the versions of
php? Is there a good site? Maybe a table with a feature comparison?
Thanks for your help.
Re: problem with different versions of php
It's the default parameter as a reference that's not accepted in PHP 4.
i.e. the following two work on 4 and 5:
function CheckMappings($badMappings = array())
But the following, as you have it, only works on 5:
function CheckMappings(&$badMappings = array())
There's a note in
that says: "Note: As of PHP 5, default values may be passed by reference."
Andy Hassall :: email@example.com :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool