3v4l.org

run code in 300+ PHP versions simultaneously
<?php class render { /** @var array */ private static $extensions; public static function __callStatic($function, $args) { // check if method exists if ( method_exists( __CLASS__, $function )) { self::{$function}(self::$args); } elseif (isset(self::$extensions[$function])) { (self::$extensions[$function])($args); } } public static function title($args) { echo 'Calling title()', PHP_EOL; } public static function register(string $name, callable $callback) { self::$extensions[$name] = $callback; } } render::register('custom', function(...$args) { echo 'Calling custom function', PHP_EOL; var_dump($args); }); render::title(1, 2, 3, 4); render::custom(1, 2, 3, 4);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oOiN6
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'render', 'register'
          1        SEND_VAL                                                 'custom'
          2        DECLARE_LAMBDA_FUNCTION                          ~0      [0]
   31     3        SEND_VAL                                                 ~0
   28     4        DO_FCALL                                      0          
   33     5        INIT_STATIC_METHOD_CALL                                  'render', 'title'
          6        SEND_VAL                                                 1
          7        SEND_VAL                                                 2
          8        SEND_VAL                                                 3
          9        SEND_VAL                                                 4
         10        DO_FCALL                                      0          
   35    11        INIT_STATIC_METHOD_CALL                                  'render', 'custom'
         12        SEND_VAL_EX                                              1
         13        SEND_VAL_EX                                              2
         14        SEND_VAL_EX                                              3
         15        SEND_VAL_EX                                              4
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oOiN6
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV_VARIADIC                                    !0      
   29     1        ECHO                                                     'Calling+custom+function'
          2        ECHO                                                     '%0A'
   30     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   31     6      > RETURN                                                   null

End of Dynamic Function 0

Class render:
Function __callstatic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/oOiN6
function name:  __callStatic
number of ops:  22
compiled vars:  !0 = $function, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_FCALL                                               'method_exists'
          3        SEND_VAL                                                 'render'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->13
   11     7    >   INIT_STATIC_METHOD_CALL                                  !0
          8        CHECK_FUNC_ARG                                           
          9        FETCH_STATIC_PROP_FUNC_ARG   unknown             $3      'args'
         10        SEND_FUNC_ARG                                            $3
         11        DO_FCALL                                      0          
   10    12      > JMP                                                      ->21
   12    13    >   FETCH_STATIC_PROP_IS                             ~5      'extensions'
         14        ISSET_ISEMPTY_DIM_OBJ                         0          ~5, !0
         15      > JMPZ                                                     ~6, ->21
   13    16    >   FETCH_STATIC_PROP_R          unknown             ~7      'extensions'
         17        FETCH_DIM_R                                      ~8      ~7, !0
         18        INIT_DYNAMIC_CALL                                        ~8
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0          
   15    21    > > RETURN                                                   null

End of function __callstatic

Function title:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oOiN6
function name:  title
number of ops:  4
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        ECHO                                                     'Calling+title%28%29'
          2        ECHO                                                     '%0A'
   20     3      > RETURN                                                   null

End of function title

Function register:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oOiN6
function name:  register
number of ops:  6
compiled vars:  !0 = $name, !1 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        FETCH_STATIC_PROP_W          global              $2      'extensions'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   25     5      > RETURN                                                   null

End of function register

End of class render.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.34 ms | 1016 KiB | 15 Q