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.

Reply via email to