3v4l.org

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

Function create_function2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XRICB
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      '%00lambda_', ~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:
158.8 ms | 1403 KiB | 21 Q