/    Sign up×
Community /Pin to ProfileBookmark

what does the & symbol mean here? function $ funcNam() { ..

not sure if i’ve come across this before or not. this is from a class file of a shopping cart i’m
currently having to working with

function & getStaticProperty($var)
{
static $staticProperty;
return $staticProperty;
}

what does the ‘&’ symbol mean??,

thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@eval_BadCode_Dec 27.2012 — That is very odd. It is typically called the referencing operator, (a reference to a value in memory as opposed to a value itself).

I'm not sure what it means in this situation... What PHP version are you running?
Copy linkTweet thisAlerts:
@eval_BadCode_Dec 27.2012 — http://php.net/manual/en/language.references.return.php

it's returning a reference to a static value. Keep in mind PHP uses a reference counting system for garbage collection. I don't see any reason to do this, perhaps this code was written as some type of 'work around' in an older version of PHP.
×

Success!

Help @toptomato spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...