3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NumberWrapper { private $number; public function __construct($number) { $this->number = $number; } } class CollectionGenerator { public function create($array, $class) { if(!class_exists($class)) throw new Exception('Kur'); $collection = []; foreach($array as $item) { $collection[] = new $class($item); } } } $someArray = [1, 2, 3, 4]; $wrappedArray = CollectionGenerator::create($someArray, 'NumberWrapper'); var_dump($wrappedArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qefOv
function name:  (null)
number of ops:  10
compiled vars:  !0 = $someArray, !1 = $wrappedArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_STATIC_METHOD_CALL                                  'CollectionGenerator', 'create'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'NumberWrapper'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   22     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function __construct

End of class NumberWrapper.

Class CollectionGenerator:
Function create:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/qefOv
function name:  create
number of ops:  23
compiled vars:  !0 = $array, !1 = $class, !2 = $collection, !3 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'class_exists'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $4      
          5        BOOL_NOT                                         ~5      $4
          6      > JMPZ                                                     ~5, ->11
          7    >   NEW                                              $6      'Exception'
          8        SEND_VAL_EX                                              'Kur'
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $6
   13    11    >   ASSIGN                                                   !2, <array>
   14    12      > FE_RESET_R                                       $9      !0, ->21
         13    > > FE_FETCH_R                                               $9, !3, ->21
   15    14    >   FETCH_CLASS                                   0  $11     !1
         15        NEW                                              $12     $11
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0          
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  $12
   14    20      > JMP                                                      ->13
         21    >   FE_FREE                                                  $9
   17    22      > RETURN                                                   null

End of function create

End of class CollectionGenerator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.77 ms | 1400 KiB | 17 Q