3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = function($p = 'abcde', $c = 'abc') { return substr($p, 0, strlen($c)) == $c; }; $test1 = function($p = 'abcde', $c = 'abc') { return strncmp($p, $c, strlen($c)); }; $print = function($closure, $s, $cycles = 10000) { for ($i =0; $i < $cycles; $i++) { $closure(); } echo printf('Runns: %.6f', 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/AdN7j
function name:  (null)
number of ops:  21
compiled vars:  !0 = $test, !1 = $test1, !2 = $print
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAdN7j%3A3%240'
          1        ASSIGN                                                   !0, ~3
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAdN7j%3A9%241'
          3        ASSIGN                                                   !1, ~5
   15     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAdN7j%3A15%242'
          5        ASSIGN                                                   !2, ~7
   25     6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $9      
         11        SEND_VAR_NO_REF_EX                                       $9
         12        DO_FCALL                                      0          
   26    13        INIT_DYNAMIC_CALL                                        !2
         14        SEND_VAR_EX                                              !1
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $11     
         18        SEND_VAR_NO_REF_EX                                       $11
         19        DO_FCALL                                      0          
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAdN7j%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AdN7j
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $p, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      'abcde'
          1        RECV_INIT                                        !1      'abc'
    5     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
    6    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAdN7j%3A3%240

Function %00%7Bclosure%7D%2Fin%2FAdN7j%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AdN7j
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $p, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      'abcde'
          1        RECV_INIT                                        !1      'abc'
   11     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
   12     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAdN7j%3A9%241

Function %00%7Bclosure%7D%2Fin%2FAdN7j%3A15%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/AdN7j
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $closure, !1 = $s, !2 = $cycles, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      10000
   17     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->8
   18     5    >   INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0          
   17     7        PRE_INC                                                  !3
          8    >   IS_SMALLER                                               !3, !2
          9      > JMPNZ                                                    ~7, ->5
   20    10    >   INIT_FCALL                                               'printf'
         11        SEND_VAL                                                 'Runns%3A+%25.6f'
         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
   21    19        ECHO                                                     '%0A'
   22    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAdN7j%3A15%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.43 ms | 1392 KiB | 21 Q