473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem with different versions of php

Hi,

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:

function CheckMappings(&$badMappings=array())

On a system with php4 the following error is thrown:

Parse error: parse error, unexpected '=', expecting ')' in <phpfileon
line 42

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.
Sascha

Nov 10 '06 #1
1 997
On 9 Nov 2006 22:04:54 -0800, he*****@wiso.uni-koeln.de wrote:
>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:

function CheckMappings(&$badMappings=array())

On a system with php4 the following error is thrown:

Parse error: parse error, unexpected '=', expecting ')' in <phpfileon
line 42

Now I would like to know, what the problem is. Is it the '&' or the
default value assignment or a combination of both?
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())
function CheckMappings(&$badMappings)

But the following, as you have it, only works on 5:

function CheckMappings(&$badMappings = array())

There's a note in
http://www.php.net/manual/en/functio...uments.default
that says: "Note: As of PHP 5, default values may be passed by reference."

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
by: Joh | last post by:
hello, i'm trying to understand how i could build following consecutive sets from a root one using generator : l = would like to produce : , , , ,
7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
5
by: Charles Blaquière | last post by:
As part of my explorations in liquid design, I'm exploring ways to use the overflow: hidden property -- when browser windows become too narrow, I want (some) images to get cropped rather than have...
2
by: ninadk | last post by:
i am using win2k and my php.ini is located in winnt folder but i don't want php.ini file at that place due to security reasons. please tell me how do i change the php.ini path.
35
by: +-={K-SoL}=-+ | last post by:
when I try to reference 2 obfuscated libraries at the same time visual studio gives me a compilation error since the obfuscator has converted some name spaces to a and b in both libraries, now I...
26
by: CKR Rajesh | last post by:
Hi, I have 2 dlls on which i have the same class MyClass defined. Say A.dll and B.dll The classes have a function (but different functionality) void f(); I use .Net late binding using...
0
by: Brinkie | last post by:
Hi, I have the following situation: I have a COM enabled application installed on multiple machines. I'm building a management application for the COM application. Normaly this is very easy...
11
by: alex sparsky | last post by:
I have a rather unique problem that I need some advice on. I have multiple c# controls that need to make use of a common namespace. So when I go to include both controls that make use of that...
4
by: mavis | last post by:
If I want to assign different value to different versions as the followings: <versions> <version> <name> a20 </name> <value> 10 </value> </version> <version>
11
by: Don | last post by:
QUESTIONS: 1. Has anyone figured out how to successfully install the Office 97 Pro Service Release 2 patch in Vista? 2. Has anyone successfully installed an Office 97 Pro CD (SR2 version) in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.