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
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 :
Returning by reference is useful when you want to use a function to find to which variable a reference should be bound.
The same syntax can be used with functions that return references, and with the new operator (since PHP 4.0.4 and before PHP 5.0.0):
<?php $foo =& find_var($bar); ?>Since PHP 5, new returns a reference automatically, so using
=&in this context is deprecated and produces anE_STRICTmessage.
So if you're using >= PHP 5 it's not a really great idea to use this notation.
Resources :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With