Page 1 of 1

Class funtion question.

Posted: Wed Apr 05, 2006 7:30 pm
by pennythetuff
What does the & symbol mean in a function declaration?

Example

Code: Select all

function &fun_name() {
     . . .
}

Posted: Wed Apr 05, 2006 7:39 pm
by Christopher
It means that the function returns a reference to a variable. In PHP4 it is usually used to return a reference to an object created in the function. But it can also be used to return a reference to other data in circumstances.

Posted: Wed Apr 05, 2006 8:06 pm
by pennythetuff
Alright, that makes sense, thanks.

Here's another question. In PHP 4 is there any way to set a functions access type? Like private, protected, or public? Thanks.

Posted: Wed Apr 05, 2006 8:17 pm
by patrikG
nope, that's only available from PHP5.+

Posted: Wed Apr 05, 2006 8:18 pm
by pennythetuff
That's what I thought. Thanks.