i using word press, and i try to learn it,
but is see the code which i didn’t understand
$post = &get_post($id);
i see ‘&’ before the get_post,
what is ‘&’ meaning?
thank
i using word press, and i try to learn it,
but is see the code which i didn’t understand
$post = &get_post($id);
i see ‘&’ before the get_post,
what is ‘&’ meaning?
thank
You must be logged in to post a comment.
Here you’re getting a reference to the result of
get_post($id)
.In particular you’re using the “returning by reference” technique.
Returning References :
So if you’re using
>= PHP 5
it’s not a really great idea to use this notation.Resources :
Passing or assigning by reference.
Now you already know that is for return by reference, next things is the effect of that.
The effect will be this:
Whenever you change $post variable’s value, you are actually changing the get_post($id) content. get_post() return object having all the info about that post in database.