[development] += on arrays

vlado vlado at dikini.net
Tue Jan 17 11:51:02 UTC 2006


> jvandyk raised the question whether += is officially supported by PHP as  
> it is not in the documentation. I contacted Goba who pointed me to  
> lxr.php.net and from there I read the relevant pieces of PHP source code  
> and it's quite clear it does.
!#@%$"!

> Stop here if you are not interested in gory  
> details. I said you should stop, right? OK, here are the details if you  
> have not stopped:
> 
> http://lxr.php.net/search?string=T_PLUS_EQUAL
> 
> both in Zend and ZendEngine2 we can see that T_PLUS_EQUAL is executed by:
> 
> zend_do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 TSRMLS_CC);
> 
> so we move on to http://lxr.php.net/search?string=ZEND_ASSIGN_ADD

RTFM :)))

"In addition to the basic assignment operator, there are "combined
operators" for all of the binary arithmetic and string operators that
allow you to use a value in an expression and then set its value to the
result of that expression. For example:"
from: http://www.php.net/manual/en/language.operators.assignment.php

Sometimes it does pay off reading the manual....



More information about the development mailing list