rfc:assignment-overloading

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
rfc:assignment-overloading [2016/01/04 00:32] – created pollitarfc:assignment-overloading [2016/01/04 00:42] – Fix ** and **= being treated as formatting pollita
Line 7: Line 7:
  
 ===== Introduction ===== ===== Introduction =====
-PHP allows for basic operator overloading for builtin objects.  For example, in the following code, gmp_init() produces an object instance of class "GMP", yet the addition operation is not only valid, it produces a valid result (a new object with an updated value).+PHP allows for basic operator overloading for builtin objects.  For example, in the following code, gmp_init() produces an object instance of class "GMP", yet the addition operation is not only valid, it produces a valid result (a new object with an updated value).  
  
   <?php   <?php
Line 14: Line 14:
   var_dump($h); // object(GMP)#2 { ["num"]=>125 }   var_dump($h); // object(GMP)#2 { ["num"]=>125 }
  
-Specifically, the following basic operators are overloaded: + - * / ** .+Specifically, the following basic operators are overloaded: + - * / %%**%% .
  
-In addition, the assignment versions of these operators ( += -= *= /= **= .= ) are supported by executing a normal operation followed by a store.  Thus the following two blocks of code are effectively identical.+In addition, the assignment versions of these operators ( += -= *= /= %%**%%= .= ) are supported by executing a normal operation followed by a store.  Thus the following two blocks of code are effectively identical.
  
   <?php   <?php
rfc/assignment-overloading.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1