3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Any; $value = array( ); for ($i=0;$i<1e6;$i++) { $value[] = $i; } $start = microtime(true); $values = array_map(function($item){ return $item+1;}, $value); $end = microtime(true); echo "Simple func took: ", number_format(($end-$start)*1e3, 2), PHP_EOL; $start = microtime(true); $values = \array_map(function($item){ return $item+1;}, $value); $end = microtime(true); echo "Direct func took: ", number_format(($end-$start)*1e3, 2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
Branch analysis from position: 3
filename:       /in/fm4IU
function name:  (null)
number of ops:  55
compiled vars:  !0 = $value, !1 = $i, !2 = $start, !3 = $values, !4 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->6
    9     3    >   ASSIGN_DIM                                               !0
          4        OP_DATA                                                  !1
    8     5        PRE_INC                                                  !1
          6    >   IS_SMALLER                                               !1, 1.0e+6
          7      > JMPNZ                                                    ~9, ->3
   12     8    >   INIT_NS_FCALL_BY_NAME                                    'Any%5Cmicrotime'
          9        SEND_VAL_EX                                              <true>
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !2, $10
   13    12        INIT_NS_FCALL_BY_NAME                                    'Any%5Carray_map'
         13        DECLARE_LAMBDA_FUNCTION                                  '%00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A13%240'
         14        SEND_VAL_EX                                              ~12
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $13     
         17        ASSIGN                                                   !3, $13
   14    18        INIT_NS_FCALL_BY_NAME                                    'Any%5Cmicrotime'
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0  $15     
         21        ASSIGN                                                   !4, $15
   15    22        ECHO                                                     'Simple+func+took%3A+'
         23        INIT_NS_FCALL_BY_NAME                                    'Any%5Cnumber_format'
         24        SUB                                              ~17     !4, !2
         25        MUL                                              ~18     ~17, 1000
         26        SEND_VAL_EX                                              ~18
         27        SEND_VAL_EX                                              2
         28        DO_FCALL                                      0  $19     
         29        ECHO                                                     $19
         30        FETCH_CONSTANT                                   ~20     'Any%5CPHP_EOL'
         31        ECHO                                                     ~20
   17    32        INIT_NS_FCALL_BY_NAME                                    'Any%5Cmicrotime'
         33        SEND_VAL_EX                                              <true>
         34        DO_FCALL                                      0  $21     
         35        ASSIGN                                                   !2, $21
   18    36        INIT_FCALL                                               'array_map'
         37        DECLARE_LAMBDA_FUNCTION                                  '%00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A18%241'
         38        SEND_VAL                                                 ~23
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !3, $24
   19    42        INIT_NS_FCALL_BY_NAME                                    'Any%5Cmicrotime'
         43        SEND_VAL_EX                                              <true>
         44        DO_FCALL                                      0  $26     
         45        ASSIGN                                                   !4, $26
   20    46        ECHO                                                     'Direct+func+took%3A+'
         47        INIT_NS_FCALL_BY_NAME                                    'Any%5Cnumber_format'
         48        SUB                                              ~28     !4, !2
         49        MUL                                              ~29     ~28, 1000
         50        SEND_VAL_EX                                              ~29
         51        SEND_VAL_EX                                              2
         52        DO_FCALL                                      0  $30     
         53        ECHO                                                     $30
         54      > RETURN                                                   1

Function %00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm4IU
function name:  Any\{closure}
number of ops:  4
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A13%240

Function %00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A18%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fm4IU
function name:  Any\{closure}
number of ops:  4
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00any%5C%7Bclosure%7D%2Fin%2Ffm4IU%3A18%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.06 ms | 1400 KiB | 19 Q