Paul Taulborg wrote:
On Fri, Sep 20, 2013 at 10:01 AM, ruben <ruben.santac...@gmail.com> wrote:
Pascal Chevrel wrote:
Le 20/09/2013 14:06, ruben a écrit :
Hi,
first of all I want to say that I am just a newbie in PHP. I am
switching to PHP from other languages and I am exploring how PHP manages
references. To do that I am gathering information about what happens
with Symbol Tables and Variables Containers when using references. You
know: reference-counting, copy-on-write and all that stuff...
I found out some cases where I think that some Variable Containers
copies could be skipped, thus saving memory and improving performance
relying in the copy-on-write principle. I wrote a PDF trying to explain
what I mean. It is not written in a very techy language, because I am
just new and don't know too much about the internals, but I hope you can
understand it and post your comments.
Probably if my "update" hasn't been done yet, is because it is not
possible, but I will very glad to hear your comments and learn from you.
Thank you very much.
Hi Ruben,
I think you forgot to put a link to your pdf :)
Regards,
Pascal
Sorry, here it is:
https://www.dropbox.com/s/wxdc99miw82zje9/PHP_references.pdf
Change the function to:
function & do_something(& $s) {
and it should do what you are expecting, reusing a single reference.
http://www.php.net/manual/en/language.references.return.php for more
reference.
Yes, Paul. Thanks for your answer. But the function I wrote is only a
sample code of a function receiving a parameter by reference. It is a
different situation from the one you propose.
To be clear, I am not asking how to get what I am expecting, because I
am not expecting anything. Only showing a behaviour that I think could
be optimized and I don't know why it isn't.
Regards,
Ruben.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php