3v4l.org

run code in 500+ PHP versions simultaneously
<?php $cmds = array_fill(0, 10000, '$abc = 123;'); function test($label, $fn) { $start = microtime(true); for ($i = 0; $i < 10; $i++) { $fn(); } $delta = microtime(true) - $start; echo "{$label}: {$delta}\n"; } test('array_map', function() use($cmds) { array_map(function ($a) { eval($a); }, $cmds); }); test('foreach', function() use($cmds) { foreach ($cmds as $cmd) { eval($cmd); } });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lR7SS
function name:  (null)
number of ops:  19
compiled vars:  !0 = $cmds
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'array_fill'
          1        SEND_VAL                                                     0
          2        SEND_VAL                                                     10000
          3        SEND_VAL                                                     '%24abc+%3D+123%3B'
          4        DO_ICALL                                             $1      
          5        ASSIGN                                                       !0, $1
   17     6        INIT_FCALL                                                   'test'
          7        SEND_VAL                                                     'array_map'
          8        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
          9        BIND_LEXICAL                                                 ~3, !0
   21    10        SEND_VAL                                                     ~3
   17    11        DO_FCALL                                          0          
   23    12        INIT_FCALL                                                   'test'
         13        SEND_VAL                                                     'foreach'
         14        DECLARE_LAMBDA_FUNCTION                              ~5      [1]
         15        BIND_LEXICAL                                                 ~5, !0
   27    16        SEND_VAL                                                     ~5
   23    17        DO_FCALL                                          0          
   27    18      > 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/lR7SS
function name:  {closure:/in/lR7SS:17}
number of ops:  7
compiled vars:  !0 = $cmds
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   BIND_STATIC                                                  !0
   18     1        INIT_FCALL                                                   'array_map'
          2        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
   20     3        SEND_VAL                                                     ~1
          4        SEND_VAR                                                     !0
   18     5        DO_ICALL                                                     
   21     6      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lR7SS
function name:  {closure:{closure:/in/lR7SS:17}:18}
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
   19     1        INCLUDE_OR_EVAL                                              !0, EVAL
   20     2      > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/lR7SS
function name:  {closure:/in/lR7SS:23}
number of ops:  7
compiled vars:  !0 = $cmds, !1 = $cmd
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   BIND_STATIC                                                  !0
   24     1      > FE_RESET_R                                           $2      !0, ->5
          2    > > FE_FETCH_R                                                   $2, !1, ->5
   25     3    >   INCLUDE_OR_EVAL                                              !1, EVAL
   24     4      > JMP                                                          ->2
          5    >   FE_FREE                                                      $2
   27     6      > RETURN                                                       null

End of Dynamic Function 1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 8
Branch analysis from position: 13
Branch analysis from position: 8
filename:       /in/lR7SS
function name:  test
number of ops:  24
compiled vars:  !0 = $label, !1 = $fn, !2 = $start, !3 = $i, !4 = $delta
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    7     2        INIT_FCALL                                                   'microtime'
          3        SEND_VAL                                                     <true>
          4        DO_ICALL                                             $5      
          5        ASSIGN                                                       !2, $5
    9     6        ASSIGN                                                       !3, 0
          7      > JMP                                                          ->11
   10     8    >   INIT_DYNAMIC_CALL                                            !1
          9        DO_FCALL                                          0          
    9    10        PRE_INC                                                      !3
         11    >   IS_SMALLER                                                   !3, 10
         12      > JMPNZ                                                        ~10, ->8
   13    13    >   INIT_FCALL                                                   'microtime'
         14        SEND_VAL                                                     <true>
         15        DO_ICALL                                             $11     
         16        SUB                                                  ~12     $11, !2
         17        ASSIGN                                                       !4, ~12
   14    18        ROPE_INIT                                         4  ~15     !0
         19        ROPE_ADD                                          1  ~15     ~15, '%3A+'
         20        ROPE_ADD                                          2  ~15     ~15, !4
         21        ROPE_END                                          3  ~14     ~15, '%0A'
         22        ECHO                                                         ~14
   15    23      > RETURN                                                       null

End of function test

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.56 ms | 1835 KiB | 13 Q