Class funtion question.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pennythetuff
Forum Newbie
Posts: 22
Joined: Sun Feb 19, 2006 6:05 pm
Location: Kokomo, Indiana

Class funtion question.

Post by pennythetuff »

What does the & symbol mean in a function declaration?

Example

Code: Select all

function &fun_name() {
     . . .
}
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
pennythetuff
Forum Newbie
Posts: 22
Joined: Sun Feb 19, 2006 6:05 pm
Location: Kokomo, Indiana

Post 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.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

nope, that's only available from PHP5.+
pennythetuff
Forum Newbie
Posts: 22
Joined: Sun Feb 19, 2006 6:05 pm
Location: Kokomo, Indiana

Post by pennythetuff »

That's what I thought. Thanks.
Post Reply