473,473 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

error with &$variable



Parse error: syntax error, unexpected '=', expecting ')'

on function so

function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if remove &
I not have the erros;

I must change sometime in php.ini or can resolve how?
I use php4.x
Aug 12 '08 #1
6 1370
*** artev escribió/wrote (Tue, 12 Aug 2008 23:30:42 +0200):
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if remove &
I not have the erros;

I must change sometime in php.ini or can resolve how?
I use php4.x
According to the manual, you must upgrade to PHP 5 or rewrite your
function. PHP 4 doesn't allow the combination of passing by reference and
default values:

http://es2.php.net/manual/en/functions.arguments.php
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Aug 12 '08 #2
According to the manual, you must upgrade to PHP 5 or rewrite your
function. PHP 4 doesn't allow the combination of passing by reference and
default values:

http://es2.php.net/manual/en/functions.arguments.php
ok so this work only in php5
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if I write so:
function pippo($var1, &$var2, $var3 = null)
{
if(!&$var2) {&$var2 = null}
.....
}

I can resolve?
Aug 13 '08 #3
artev wrote:
>According to the manual, you must upgrade to PHP 5 or rewrite your
function. PHP 4 doesn't allow the combination of passing by reference and
default values:

http://es2.php.net/manual/en/functions.arguments.php

ok so this work only in php5
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if I write so:
function pippo($var1, &$var2, $var3 = null)
{
if(!&$var2) {&$var2 = null}
....
}

I can resolve?
if (!$var2) {$var2 = null;}

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Aug 13 '08 #4
*** artev escribió/wrote (Wed, 13 Aug 2008 17:18:43 +0200):
ok so this work only in php5
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if I write so:
function pippo($var1, &$var2, $var3 = null)
{
if(!&$var2) {&$var2 = null}
....
}
It's not exactly the same. This way you must call pippo() with at least
$var1 and $var2, so $var2 is no longer optional.

I can think of a couple of tricks but it looks like that the best solution
would be a small redesign.

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Aug 13 '08 #5
Il Wed, 13 Aug 2008 18:14:32 +0200, Álvaro G. Vicario ha scritto:
*** artev escribió/wrote (Wed, 13 Aug 2008 17:18:43 +0200):
>ok so this work only in php5
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if I write so:
function pippo($var1, &$var2, $var3 = null)
{
if(!&$var2) {&$var2 = null}
....
}

It's not exactly the same. This way you must call pippo() with at least
$var1 and $var2, so $var2 is no longer optional.

function pippo($var1, &$var2 = null, $var3 = null) { ....}
but also so $var2 is no longer optional ?
Aug 13 '08 #6
..oO(artev)
>According to the manual, you must upgrade to PHP 5 or rewrite your
function. PHP 4 doesn't allow the combination of passing by reference and
default values:

http://es2.php.net/manual/en/functions.arguments.php

ok so this work only in php5
function pippo($var1, &$var2 = null, $var3 = null) { ....}

but if I write so:
function pippo($var1, &$var2, $var3 = null)
{
if(!&$var2) {&$var2 = null}
....
}

I can resolve?
Upgrade to PHP 5.

Micha
Aug 13 '08 #7

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

Similar topics

7
by: bob garbados | last post by:
Can someone point out why this is giving me the error "Variable is undefined: 'arrProducts' " <begin_code> Dim m_arrProducts() Sub SerializeCart() ReDim m_arrProducts(m_intCartCount -1)...
0
by: haxmya | last post by:
#1 what is that variable length scrolling stuff on this forum, it seems to be a bug that messes up my searches. #2 More Importantly. I have developed an Internet Explorer Toolbar (Band Object)...
10
by: ElanKathir .S.N | last post by:
Hi all ! VB.NET adds the ability to create variables that are visible only within a block. A block is any section of code that ends with one of the words End , Loop , or Next . This means that...
5
by: Zammy | last post by:
I'm guessing this has been explained before, but I can not seem to phrase the search correctly. I am trying to use a string (strString) in a VBA select query. I want to include the * wildcard in...
3
by: redskycorp | last post by:
Hi guys ! I am new here, i just wanna ask. I know the solution for this problem is simple but i just cannot figure it out......I get the error at the italized area. Option Explicit Dim pdbQue...
4
by: vijaybabudev81 | last post by:
Hi, I want to get the error & warnings messages from program. like fatal error, variable declaration error in strict mode & etc.. is it possible in perl? plz give your suggestions. Thanks...
0
by: yogi_bear_79 | last post by:
I shorted the following code for the purpose of this post. I get a run-time error that value is not defined. I don't understand what I have done wrong. Through varios testing methods I've...
1
by: Chuck Chopp | last post by:
I have some code that is being built on the following: Windows Server 2003, both 32-bit & 64-bit editions Windows Vista, both 32-bit & 64-bit editions Windows Server 2008, both 32-bit & 64-bit...
1
by: hungmaibaby | last post by:
Hi all Im having difficulty with this problem please help or any advice would be nice A hardware store needs to print new price tags for all of the merchandise in the store. The store has an...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.