3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** @return class-string */ function getClassName(object $class): string { return $class::class; }; /** @param list $data */ function fromArrays(array $data, object $object): mixed { $className = getClassName($object); $callback = [$className, 'from']; if (!is_callable($callback)) { throw new RuntimeException('bad callable'); } return forward_static_call_array($callback, $data); } class A { public static function from() { var_dump(__METHOD__); } } fromArrays([], new A);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb8AZ
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'fromarrays'
          1        SEND_VAL                                                 <array>
          2        NEW                                              $0      'A'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function getclassname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb8AZ
function name:  getClassName
number of ops:  6
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        FETCH_CLASS_NAME                                 ~1      !0
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
    6     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function getclassname

Function fromarrays:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb8AZ
function name:  fromArrays
number of ops:  25
compiled vars:  !0 = $data, !1 = $object, !2 = $className, !3 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'getclassname'
          3        SEND_VAR                                                 !1
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !2, $4
   12     6        INIT_ARRAY                                       ~6      !2
          7        ADD_ARRAY_ELEMENT                                ~6      'from'
          8        ASSIGN                                                   !3, ~6
   13     9        INIT_FCALL                                               'is_callable'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $8      
         12        BOOL_NOT                                         ~9      $8
         13      > JMPZ                                                     ~9, ->18
   14    14    >   NEW                                              $10     'RuntimeException'
         15        SEND_VAL_EX                                              'bad+callable'
         16        DO_FCALL                                      0          
         17      > THROW                                         0          $10
   17    18    >   INIT_FCALL                                               'forward_static_call_array'
         19        SEND_VAR                                                 !3
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $12     
         22      > RETURN                                                   $12
   18    23*       VERIFY_RETURN_TYPE                                       
         24*     > RETURN                                                   null

End of function fromarrays

Class A:
Function from:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cb8AZ
function name:  from
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'A%3A%3Afrom'
          2        DO_ICALL                                                 
          3      > RETURN                                                   null

End of function from

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.51 ms | 1023 KiB | 18 Q