NYCPHP Meetup

NYPHP.org

[nycphp-talk] passing optional arguments by reference

Eric Persson eric at persson.tm
Fri Jan 16 13:46:10 EST 2004


Daniel Convissor wrote:
> CODE:
>     function &execute($stmt, &$data = array()) {
>     }
> 
> ERROR:
>     Parse error: parse error, unexpected '=', expecting ')'
> 
> Removing the "= array()" makes it parse fine.
> 
> So, is there a way to do this, please?

Why not just skip the = array() part and do:


function &execute($stmt, &$data = '' ) {

	if( is_array($data) ){
		//then....
	}

}

Or, did I perhaps misunderstand it?

Best regards,
	Eric
--
Download the new Mozilla Firebird web browser at 
http://www.mozilla.org/products/firebird/



More information about the talk mailing list