3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($in = false) {} function test($in) { $start = microtime(true); for ($i = 0; $i < 10000; $i++) { foo(!!$in); } echo ((microtime(true) - $start) / 1000)."\n"; } function test2($in) { $start = microtime(true); for ($i = 0; $i < 10000; $i++) { foo((boolean)$in); } echo ((microtime(true) - $start) / 1000)."\n"; } test($tmp); test2($tmp); echo "\n"; $tmp = false; test($tmp); test2($tmp); echo "\n"; $tmp = '0'; test($tmp); test2($tmp);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hVrpu
function name:  (null)
number of ops:  23
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAR                                                 !0
          2        DO_FCALL                                      0          
   20     3        INIT_FCALL                                               'test2'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0          
   21     6        ECHO                                                     '%0A'
   22     7        ASSIGN                                                   !0, <false>
   23     8        INIT_FCALL                                               'test'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0          
   24    11        INIT_FCALL                                               'test2'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0          
   25    14        ECHO                                                     '%0A'
   26    15        ASSIGN                                                   !0, '0'
   27    16        INIT_FCALL                                               'test'
         17        SEND_VAR                                                 !0
         18        DO_FCALL                                      0          
   28    19        INIT_FCALL                                               'test2'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0          
         22      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hVrpu
function name:  foo
number of ops:  2
compiled vars:  !0 = $in
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      <false>
          1      > RETURN                                                   null

End of function foo

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

End of function test

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

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.67 ms | 1403 KiB | 22 Q