3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { } class UserProvider { public static function getServices() { return ['user']; } public static function user() { return new User(); } } $services = array_map(function($factoryName) { return [UserProvider::class, $factoryName](); }, UserProvider::getServices()); var_dump($services);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fGuZK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $services
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'array_map'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfGuZK%3A17%240'
   21     2        SEND_VAL                                                 ~1
          3        INIT_STATIC_METHOD_CALL                                  'UserProvider', 'getServices'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                         $3      
   17     7        ASSIGN                                                   !0, $3
   23     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfGuZK%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fGuZK
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $factoryName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_ARRAY                                       ~1      'UserProvider'
          2        ADD_ARRAY_ELEMENT                                ~1      !0
          3        INIT_DYNAMIC_CALL                                        ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   21     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfGuZK%3A17%240

Class User: [no user functions]
Class UserProvider:
Function getservices:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fGuZK
function name:  getServices
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   <array>
   10     1*     > RETURN                                                   null

End of function getservices

Function user:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fGuZK
function name:  user
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'User'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   14     3*     > RETURN                                                   null

End of function user

End of class UserProvider.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.42 ms | 1396 KiB | 17 Q