3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait HydrateBehaviour { public static function hydrate($other) { $new = new self(); foreach ($other as $k => $v) { $new->{$k} = $v; } return $new; } } class Entity { use HydrateBehaviour; private $ololo; private $foo; private $bar; public function out() { echo $this->ololo, $this->foo, $this->bar; } } $en = Entity::hydrate(['ololo' => 1, 'foo' => 2]); $en->out();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbaSU
function name:  (null)
number of ops:  8
compiled vars:  !0 = $en
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'entity'
   27     1        INIT_STATIC_METHOD_CALL                                  'Entity', 'hydrate'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   28     5        INIT_METHOD_CALL                                         !0, 'out'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class HydrateBehaviour:
Function hydrate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/JbaSU
function name:  hydrate
number of ops:  13
compiled vars:  !0 = $other, !1 = $new, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        NEW                          self                $4      
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
    8     4      > FE_RESET_R                                       $7      !0, ->10
          5    > > FE_FETCH_R                                       ~8      $7, !2, ->10
          6    >   ASSIGN                                                   !3, ~8
    9     7        ASSIGN_OBJ                                               !1, !3
          8        OP_DATA                                                  !2
    8     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $7
   11    11      > RETURN                                                   !1
   12    12*     > RETURN                                                   null

End of function hydrate

End of class HydrateBehaviour.

Class Entity:
Function out:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JbaSU
function name:  out
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      'ololo'
          1        ECHO                                                     ~0
          2        FETCH_OBJ_R                                      ~1      'foo'
          3        ECHO                                                     ~1
          4        FETCH_OBJ_R                                      ~2      'bar'
          5        ECHO                                                     ~2
   24     6      > RETURN                                                   null

End of function out

End of class Entity.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
215.4 ms | 1399 KiB | 13 Q