Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-04-05 Thread Rowan Collins
Sara Golemon wrote on 01/04/2016 02:52: On Thu, Mar 31, 2016 at 9:47 AM, Huqiu Liao wrote: I have a question about Assign By Reference and I posted on StackOverflow, I'd like to know the reason behind it, and I did not get any this kind of answer, can anyone give me some clues. Are you asking

Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-03-31 Thread Sara Golemon
On Thu, Mar 31, 2016 at 9:47 AM, Huqiu Liao wrote: > I have a question about Assign By Reference and I posted on StackOverflow, > I'd like to know the reason behind it, and I did not get any this kind of > answer, can anyone give me some clues. > Are you asking out of curiosity? Or because you thi

Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-03-31 Thread Yasuo Ohgaki
Hi Huqui, On Fri, Apr 1, 2016 at 1:47 AM, Huqiu Liao wrote: > 4echo (++$i) + (++$i); I brought up this topic before and the conclusion is This kind of operation result is undefined and user shouldn't write such expression. There are undefined behaviors for ++ and --. C/C++ has undefined be

Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-03-31 Thread Rowan Collins
On 31/03/2016 18:23, Rowan Collins wrote: Maybe in PHP 5 the opcodes are the same, but $2 and $3 somehow end up as references to !0, rather than new zvals So, it turns out, this is exactly what happens. Specifically, there is a call to SEPARATE_ZVAL_IF_NOT_REF(var_ptr); in the definition of th

Re: [PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-03-31 Thread Rowan Collins
Huqiu Liao wrote on 31/03/2016 17:47: Hi, internals, I have a question about Assign By Reference and I posted on StackOverflow, I'd like to know the reason behind it, and I did not get any this kind of answer, can anyone give me some clues. --- We have a piece of simple code: 1 To me, th

[PHP-DEV] Copy On Write and Assign By Reference perform different on PHP5 and PHP7

2016-03-31 Thread Huqiu Liao
Hi, internals, I have a question about Assign By Reference and I posted on StackOverflow, I'd like to know the reason behind it, and I did not get any this kind of answer, can anyone give me some clues. --- We have a piece of simple code: 1http://php.net/manual/en/migration70.incompatible.p

[PHP-DEV] Copy on write

2007-04-23 Thread [EMAIL PROTECTED]
Hello everyone in version the 5.2.1 i get strange results when using the reference operator on arrays. When writing a function "a" with call by reference: function &a(&$anArray) { return $anArray; } and another function "b": function b($anArray) { return $anArray; } Then on my machine it take