3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Human { private $name, $age; public function __construct($name, $age) { $this->name = $name; $this->age = $age; } } $data = [["John", 23], ["Nick", 32], ["Ann", 17]]; $humans = []; foreach($data as $item) { $r = new ReflectionClass("Human"); $humans[] = $r->newInstance($item); } var_dump($humans);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/COnUL
function name:  (null)
number of ops:  19
compiled vars:  !0 = $data, !1 = $humans, !2 = $item, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   16     2      > FE_RESET_R                                       $6      !0, ->14
          3    > > FE_FETCH_R                                               $6, !2, ->14
   18     4    >   NEW                                              $7      'ReflectionClass'
          5        SEND_VAL_EX                                              'Human'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !3, $7
   19     8        INIT_METHOD_CALL                                         !3, 'newInstance'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0  $11     
         11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  $11
   16    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $6
   22    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Human:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/COnUL
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name, !1 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'age'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

End of class Human.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.52 ms | 1396 KiB | 15 Q