3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create_function2($args, $content) { static $counter = PHP_INT_MAX; $funcname = "lambda_" . (--$counter); $rawErrorHandler = null; $rawErrorHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) use (&$rawErrorHandler) { var_dump($errno, $errstr, $errfile, $errline, $errcontext); if ($rawErrorHandler) { return call_user_func($rawErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext); } else { return false; } }, E_WARNING); eval("function {$funcname}({$args}){{$content};}"); restore_error_handler(); return $funcname; } $f = create_function2('$a,$b', 'return $a+$b;'); var_dump($f); var_dump($f(1,2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JSI45
function name:  (null)
number of ops:  16
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'create_function2'
          1        SEND_VAL                                                 '%24a%2C%24b'
          2        SEND_VAL                                                 'return+%24a%2B%24b%3B'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   24     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   25     8        INIT_FCALL                                               'var_dump'
          9        INIT_DYNAMIC_CALL                                        !0
         10        SEND_VAL_EX                                              1
         11        SEND_VAL_EX                                              2
         12        DO_FCALL                                      0  $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function create_function2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JSI45
function name:  create_function2
number of ops:  26
compiled vars:  !0 = $args, !1 = $content, !2 = $counter, !3 = $funcname, !4 = $rawErrorHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        BIND_STATIC                                              !2
    5     3        PRE_DEC                                          ~5      !2
          4        CONCAT                                           ~6      'lambda_', ~5
          5        ASSIGN                                                   !3, ~6
    7     6        ASSIGN                                                   !4, null
    8     7        INIT_FCALL                                               'set_error_handler'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJSI45%3A8%240'
          9        BIND_LEXICAL                                             ~9, !4
   15    10        SEND_VAL                                                 ~9
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $10     
    8    13        ASSIGN                                                   !4, $10
   16    14        ROPE_INIT                                     7  ~13     'function+'
         15        ROPE_ADD                                      1  ~13     ~13, !3
         16        ROPE_ADD                                      2  ~13     ~13, '%28'
         17        ROPE_ADD                                      3  ~13     ~13, !0
         18        ROPE_ADD                                      4  ~13     ~13, '%29%7B'
         19        ROPE_ADD                                      5  ~13     ~13, !1
         20        ROPE_END                                      6  ~12     ~13, '%3B%7D'
         21        INCLUDE_OR_EVAL                                          ~12, EVAL
   17    22        INIT_FCALL                                               'restore_error_handler'
         23        DO_ICALL                                                 
   19    24      > RETURN                                                   !3
   20    25*     > RETURN                                                   null

End of function create_function2

Function %00%7Bclosure%7D%2Fin%2FJSI45%3A8%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JSI45
function name:  {closure}
number of ops:  25
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline, !4 = $errcontext, !5 = $rawErrorHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        BIND_STATIC                                              !5
    9     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !4
         12        DO_ICALL                                                 
   10    13      > JMPZ                                                     !5, ->23
   11    14    >   INIT_USER_CALL                                5          'call_user_func', !5
         15        SEND_USER                                                !0
         16        SEND_USER                                                !1
         17        SEND_USER                                                !2
         18        SEND_USER                                                !3
         19        SEND_USER                                                !4
         20        DO_FCALL                                      0  $7      
         21      > RETURN                                                   $7
         22*       JMP                                                      ->24
   13    23    > > RETURN                                                   <false>
   15    24*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJSI45%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.66 ms | 1394 KiB | 20 Q