By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

function with optional parameter passed by reference

P: n/a

Hi,

How to create function with optional parameter passed by reference?
I've tried sth like this:

function (&$param=NULL) // or: function (&$param=new array())
{
//...
}

but parser is complaining that it expected ')' after $param.
I know functions with optional parameters passed by reference exist in PHP
(ie. ereg). So what am I doing wrong?

--
Greets
adeon
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Adam Dyga wrote:
function (&$param=NULL) // or: function (&$param=new array())
{
//...
}


It does not work with PHP 4.

It works with PHP 5 (but not the second format)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.