3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function byRef(&$val) { $val = 'replaced'; } } $f = new Foo(); $var = ['original']; array_map($f->byRef(...), $var); print_r($var);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1KoE
function name:  (null)
number of ops:  14
compiled vars:  !0 = $f, !1 = $var
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $2      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
    8     3        ASSIGN                                                       !1, <array>
    9     4        INIT_FCALL                                                   'array_map'
          5        INIT_METHOD_CALL                                             !0, 'byRef'
          6        CALLABLE_CONVERT                                     ~6      
          7        SEND_VAL                                                     ~6
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                                     
   11    10        INIT_FCALL                                                   'print_r'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                                     
         13      > RETURN                                                       1

Class Foo:
Function byref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1KoE
function name:  byRef
number of ops:  3
compiled vars:  !0 = $val
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        ASSIGN                                                       !0, 'replaced'
          2      > RETURN                                                       null

End of function byref

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.91 ms | 1362 KiB | 14 Q