3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } class S { static function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } $a = $b = 'orig'; $f = array(new C, 'foo'); $f($a, $b); assert($a === 'modified'); assert($b === 'orig'); $a = $b = 'orig'; $f = array('S', 'foo'); $f($a, $b); assert($a === 'modified'); assert($b === 'orig'); $a = $b = 'orig'; $f = function(&$a, $b) { $a = 'modified'; $b = 'modified'; }; $f($a, $b); assert($a === 'modified'); assert($b === 'orig');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NiBos
function name:  (null)
number of ops:  63
compiled vars:  !0 = $a, !1 = $b, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                           ~3      !1, 'orig'
          1        ASSIGN                                                   !0, ~3
   18     2        NEW                                              $5      'C'
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~7      $5
          5        ADD_ARRAY_ELEMENT                                ~7      'foo'
          6        ASSIGN                                                   !2, ~7
   19     7        INIT_DYNAMIC_CALL                                        !2
          8        SEND_VAR_EX                                              !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
   20    11        ASSERT_CHECK                                             
         12        INIT_FCALL                                               'assert'
         13        IS_IDENTICAL                                     ~10     !0, 'modified'
         14        SEND_VAL                                                 ~10
         15        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%27modified%27%29'
         16        DO_ICALL                                                 
   21    17        ASSERT_CHECK                                             
         18        INIT_FCALL                                               'assert'
         19        IS_IDENTICAL                                     ~12     !1, 'orig'
         20        SEND_VAL                                                 ~12
         21        SEND_VAL                                                 'assert%28%24b+%3D%3D%3D+%27orig%27%29'
         22        DO_ICALL                                                 
   23    23        ASSIGN                                           ~14     !1, 'orig'
         24        ASSIGN                                                   !0, ~14
   24    25        ASSIGN                                                   !2, <array>
   25    26        INIT_DYNAMIC_CALL                                        !2
         27        SEND_VAR_EX                                              !0
         28        SEND_VAR_EX                                              !1
         29        DO_FCALL                                      0          
   26    30        ASSERT_CHECK                                             
         31        INIT_FCALL                                               'assert'
         32        IS_IDENTICAL                                     ~18     !0, 'modified'
         33        SEND_VAL                                                 ~18
         34        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%27modified%27%29'
         35        DO_ICALL                                                 
   27    36        ASSERT_CHECK                                             
         37        INIT_FCALL                                               'assert'
         38        IS_IDENTICAL                                     ~20     !1, 'orig'
         39        SEND_VAL                                                 ~20
         40        SEND_VAL                                                 'assert%28%24b+%3D%3D%3D+%27orig%27%29'
         41        DO_ICALL                                                 
   29    42        ASSIGN                                           ~22     !1, 'orig'
         43        ASSIGN                                                   !0, ~22
   30    44        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNiBos%3A30%240'
         45        ASSIGN                                                   !2, ~24
   34    46        INIT_DYNAMIC_CALL                                        !2
         47        SEND_VAR_EX                                              !0
         48        SEND_VAR_EX                                              !1
         49        DO_FCALL                                      0          
   35    50        ASSERT_CHECK                                             
         51        INIT_FCALL                                               'assert'
         52        IS_IDENTICAL                                     ~27     !0, 'modified'
         53        SEND_VAL                                                 ~27
         54        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%27modified%27%29'
         55        DO_ICALL                                                 
   36    56        ASSERT_CHECK                                             
         57        INIT_FCALL                                               'assert'
         58        IS_IDENTICAL                                     ~29     !1, 'orig'
         59        SEND_VAL                                                 ~29
         60        SEND_VAL                                                 'assert%28%24b+%3D%3D%3D+%27orig%27%29'
         61        DO_ICALL                                                 
         62      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNiBos%3A30%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NiBos
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   31     2        ASSIGN                                                   !0, 'modified'
   32     3        ASSIGN                                                   !1, 'modified'
   33     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FNiBos%3A30%240

Class C:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NiBos
function name:  foo
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !0, 'modified'
    6     3        ASSIGN                                                   !1, 'modified'
    7     4      > RETURN                                                   null

End of function foo

End of class C.

Class S:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NiBos
function name:  foo
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        ASSIGN                                                   !0, 'modified'
   13     3        ASSIGN                                                   !1, 'modified'
   14     4      > RETURN                                                   null

End of function foo

End of class S.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.72 ms | 1408 KiB | 15 Q