3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create_function2($args, $content) { static $counter = 0; $funcname = '_lambda_' . (++$counter); eval("function {$funcname} ({$args}) { {$content}; }"); return $funcname; } var_dump(bin2hex(create_function('$a,$b', 'return $a+$b;'))); $f = create_function('$a,$b', 'return $a+$b;'); var_dump($f(1,2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l9gm2
function name:  (null)
number of ops:  23
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'bin2hex'
          2        INIT_FCALL_BY_NAME                                       'create_function'
          3        SEND_VAL_EX                                              '%24a%2C%24b'
          4        SEND_VAL_EX                                              'return+%24a%2B%24b%3B'
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   12    10        INIT_FCALL_BY_NAME                                       'create_function'
         11        SEND_VAL_EX                                              '%24a%2C%24b'
         12        SEND_VAL_EX                                              'return+%24a%2B%24b%3B'
         13        DO_FCALL                                      0  $4      
         14        ASSIGN                                                   !0, $4
   13    15        INIT_FCALL                                               'var_dump'
         16        INIT_DYNAMIC_CALL                                        !0
         17        SEND_VAL_EX                                              1
         18        SEND_VAL_EX                                              2
         19        DO_FCALL                                      0  $6      
         20        SEND_VAR                                                 $6
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function create_function2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l9gm2
function name:  create_function2
number of ops:  16
compiled vars:  !0 = $args, !1 = $content, !2 = $counter, !3 = $funcname
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_INC                                          ~4      !2
          4        CONCAT                                           ~5      '_lambda_', ~4
          5        ASSIGN                                                   !3, ~5
    6     6        ROPE_INIT                                     7  ~8      'function+'
          7        ROPE_ADD                                      1  ~8      ~8, !3
          8        ROPE_ADD                                      2  ~8      ~8, '+%28'
          9        ROPE_ADD                                      3  ~8      ~8, !0
         10        ROPE_ADD                                      4  ~8      ~8, '%29+%7B+'
         11        ROPE_ADD                                      5  ~8      ~8, !1
         12        ROPE_END                                      6  ~7      ~8, '%3B+%7D'
         13        INCLUDE_OR_EVAL                                          ~7, EVAL
    7    14      > RETURN                                                   !3
    8    15*     > RETURN                                                   null

End of function create_function2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.49 ms | 1392 KiB | 17 Q