3v4l.org

run code in 300+ PHP versions simultaneously
<?php // start engines; for($i=0;$i++<2;)number_format(hrtime(true),5);test_1('hi');test_2('hi'); function test_1( $string ) {} function test_2( string $string ) {} $t = hrtime(true); for ( $i = 0; ++$i < 1e6; ) test_1( 'hi' ); echo 'untyped: ', $a=number_format( (hrtime(true)-$t)/1e9,5),"s\n"; $t = hrtime(true); for ( $i = 0; ++$i < 1e6; ) test_2( 'hi' ); echo 'typed: ', $b=number_format( (hrtime(true)-$t)/1e9,5),"s\n"; printf( 'Typed is %d%% slower.', (1-($a/$b))*100 );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 49
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 49
Branch analysis from position: 55
Branch analysis from position: 49
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
Branch analysis from position: 24
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/j7FPnW
function name:  (null)
number of ops:  76
compiled vars:  !0 = $i, !1 = $t, !2 = $a, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->9
          2    >   INIT_FCALL                                               'number_format'
          3        INIT_FCALL                                               'hrtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        SEND_VAL                                                 5
          8        DO_ICALL                                                 
          9    >   POST_INC                                         ~7      !0
         10        IS_SMALLER                                               ~7, 2
         11      > JMPNZ                                                    ~8, ->2
         12    >   INIT_FCALL_BY_NAME                                       'test_1'
         13        SEND_VAL_EX                                              'hi'
         14        DO_FCALL                                      0          
         15        INIT_FCALL_BY_NAME                                       'test_2'
         16        SEND_VAL_EX                                              'hi'
         17        DO_FCALL                                      0          
    9    18        INIT_FCALL                                               'hrtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !1, $11
   10    22        ASSIGN                                                   !0, 0
         23      > JMP                                                      ->27
         24    >   INIT_FCALL                                               'test_1'
         25        SEND_VAL                                                 'hi'
         26        DO_FCALL                                      0          
         27    >   PRE_INC                                          ~15     !0
         28        IS_SMALLER                                               ~15, 1.0e+6
         29      > JMPNZ                                                    ~16, ->24
   11    30    >   ECHO                                                     'untyped%3A+'
         31        INIT_FCALL                                               'number_format'
         32        INIT_FCALL                                               'hrtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $17     
         35        SUB                                              ~18     $17, !1
         36        DIV                                              ~19     ~18, 1.0e+9
         37        SEND_VAL                                                 ~19
         38        SEND_VAL                                                 5
         39        DO_ICALL                                         $20     
         40        ASSIGN                                           ~21     !2, $20
         41        ECHO                                                     ~21
         42        ECHO                                                     's%0A'
   14    43        INIT_FCALL                                               'hrtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $22     
         46        ASSIGN                                                   !1, $22
   15    47        ASSIGN                                                   !0, 0
         48      > JMP                                                      ->52
         49    >   INIT_FCALL                                               'test_2'
         50        SEND_VAL                                                 'hi'
         51        DO_FCALL                                      0          
         52    >   PRE_INC                                          ~26     !0
         53        IS_SMALLER                                               ~26, 1.0e+6
         54      > JMPNZ                                                    ~27, ->49
   16    55    >   ECHO                                                     'typed%3A+'
         56        INIT_FCALL                                               'number_format'
         57        INIT_FCALL                                               'hrtime'
         58        SEND_VAL                                                 <true>
         59        DO_ICALL                                         $28     
         60        SUB                                              ~29     $28, !1
         61        DIV                                              ~30     ~29, 1.0e+9
         62        SEND_VAL                                                 ~30
         63        SEND_VAL                                                 5
         64        DO_ICALL                                         $31     
         65        ASSIGN                                           ~32     !3, $31
         66        ECHO                                                     ~32
         67        ECHO                                                     's%0A'
   18    68        INIT_FCALL                                               'printf'
         69        SEND_VAL                                                 'Typed+is+%25d%25%25+slower.'
         70        DIV                                              ~33     !2, !3
         71        SUB                                              ~34     1, ~33
         72        MUL                                              ~35     ~34, 100
         73        SEND_VAL                                                 ~35
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

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

End of function test_1

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

End of function test_2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.53 ms | 967 KiB | 18 Q