3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; } class Hydrator{ public function gen() { return function (array $row) { foreach ($row as $k => $v) { $this->{$k} = $v; } }; } } $row = array( 'bar' => 1 ); $o = new Foo; $hydrator = new Hydrator; $hydrator = $hydrator->gen(); $hydrator->bindTo($o, $o); $hydrator($row); var_dump($o);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m1ONL
function name:  (null)
number of ops:  21
compiled vars:  !0 = $row, !1 = $o, !2 = $hydrator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   22     1        NEW                                              $4      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
   23     4        NEW                                              $7      'Hydrator'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $7
   24     7        INIT_METHOD_CALL                                         !2, 'gen'
          8        DO_FCALL                                      0  $10     
          9        ASSIGN                                                   !2, $10
   25    10        INIT_METHOD_CALL                                         !2, 'bindTo'
         11        SEND_VAR_EX                                              !1
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   26    14        INIT_DYNAMIC_CALL                                        !2
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0          
   28    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fm1ONL%3A9%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/m1ONL
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $row, !1 = $v, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1      > FE_RESET_R                                       $3      !0, ->8
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->8
          3    >   ASSIGN                                                   !2, ~4
   11     4        FETCH_THIS                                       $6      
          5        ASSIGN_OBJ                                               $6, !2
          6        OP_DATA                                                  !1
   10     7      > JMP                                                      ->2
          8    >   FE_FREE                                                  $3
   13     9      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fm1ONL%3A9%240

Class Foo: [no user functions]
Class Hydrator:
Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m1ONL
function name:  gen
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fm1ONL%3A9%240'
   13     1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function gen

End of class Hydrator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.96 ms | 1404 KiB | 15 Q