3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $p = implode('', range('a', 'z')); echo PHP_EOL; echo $c = substr($p, 13); echo PHP_EOL; $times = 1000 * 10 * 10; $test = function() use($p, $c) { return substr($p, 0, strlen($c)) == $c; }; $test1 = function() use ($p, $c) { return strncmp($p, $c, strlen($c)); }; $print = function($closure, $s) use ($times) { for ($i =0; $i < $times; $i++) $closure(); echo printf('Runns: %01.2f', microtime(1) - $s); echo PHP_EOL; }; $print($test, microtime(1)); $print($test1, microtime(1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OirOZ
function name:  (null)
number of ops:  45
compiled vars:  !0 = $p, !1 = $c, !2 = $times, !3 = $test, !4 = $test1, !5 = $print
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'implode'
          1        SEND_VAL                                                 ''
          2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 'a'
          4        SEND_VAL                                                 'z'
          5        DO_ICALL                                         $6      
          6        SEND_VAR                                                 $6
          7        DO_ICALL                                         $7      
          8        ASSIGN                                           ~8      !0, $7
          9        ECHO                                                     ~8
    4    10        ECHO                                                     '%0A'
    5    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 13
         14        DO_ICALL                                         $9      
         15        ASSIGN                                           ~10     !1, $9
         16        ECHO                                                     ~10
    6    17        ECHO                                                     '%0A'
    8    18        ASSIGN                                                   !2, 100000
   10    19        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOirOZ%3A10%240'
         20        BIND_LEXICAL                                             ~12, !0
         21        BIND_LEXICAL                                             ~12, !1
         22        ASSIGN                                                   !3, ~12
   15    23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOirOZ%3A15%241'
         24        BIND_LEXICAL                                             ~14, !0
         25        BIND_LEXICAL                                             ~14, !1
         26        ASSIGN                                                   !4, ~14
   20    27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOirOZ%3A20%242'
         28        BIND_LEXICAL                                             ~16, !2
         29        ASSIGN                                                   !5, ~16
   30    30        INIT_DYNAMIC_CALL                                        !5
         31        SEND_VAR_EX                                              !3
         32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 1
         34        DO_ICALL                                         $18     
         35        SEND_VAR_NO_REF_EX                                       $18
         36        DO_FCALL                                      0          
   31    37        INIT_DYNAMIC_CALL                                        !5
         38        SEND_VAR_EX                                              !4
         39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 1
         41        DO_ICALL                                         $20     
         42        SEND_VAR_NO_REF_EX                                       $20
         43        DO_FCALL                                      0          
         44      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOirOZ%3A10%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OirOZ
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $p, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   12     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        STRLEN                                           ~2      !1
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8        IS_EQUAL                                         ~4      !1, $3
          9      > RETURN                                                   ~4
   13    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOirOZ%3A10%240

Function %00%7Bclosure%7D%2Fin%2FOirOZ%3A15%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OirOZ
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $p, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   17     2        INIT_FCALL                                               'strncmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        STRLEN                                           ~2      !1
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
   18     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOirOZ%3A15%241

Function %00%7Bclosure%7D%2Fin%2FOirOZ%3A20%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/OirOZ
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $closure, !1 = $s, !2 = $times, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   22     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->8
   23     5    >   INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0          
   22     7        PRE_INC                                                  !3
          8    >   IS_SMALLER                                               !3, !2
          9      > JMPNZ                                                    ~7, ->5
   25    10    >   INIT_FCALL                                               'printf'
         11        SEND_VAL                                                 'Runns%3A+%2501.2f'
         12        INIT_FCALL                                               'microtime'
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $8      
         15        SUB                                              ~9      $8, !1
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                         $10     
         18        ECHO                                                     $10
   26    19        ECHO                                                     '%0A'
   27    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOirOZ%3A20%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.01 ms | 1404 KiB | 25 Q