3v4l.org

run code in 300+ PHP versions simultaneously
<?php $v1 = 5; $v2 = '5-4'; echo (strcmp($v1,$v2) === 0 ? 'they are the same' : 'they aren\'t the same'); $time = microtime(1); $i = 0; while($i++ < 50000) donull((strcmp($v1,$v2) === 0)); echo (microtime(1)-$time)." seconds for strcmp"; echo "\n"; $time = microtime(1); $i = 0; while($i++ < 50000) donull(((string) $v1 == (string) $v2)); echo (microtime(1)-$time)." seconds for typecasting"; function donull($v){};
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 42
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 42
Branch analysis from position: 51
Branch analysis from position: 42
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 18
Branch analysis from position: 29
Branch analysis from position: 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
filename:       /in/EcOqJ
function name:  (null)
number of ops:  58
compiled vars:  !0 = $v1, !1 = $v2, !2 = $time, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 5
    3     1        ASSIGN                                                   !1, '5-4'
    5     2        INIT_FCALL                                               'strcmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        IS_IDENTICAL                                             $6, 0
          7      > JMPZ                                                     ~7, ->10
          8    >   QM_ASSIGN                                        ~8      'they+are+the+same'
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~8      'they+aren%27t+the+same'
         11    >   ECHO                                                     ~8
    8    12        INIT_FCALL                                               'microtime'
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
    9    16        ASSIGN                                                   !3, 0
   10    17      > JMP                                                      ->26
         18    >   INIT_FCALL_BY_NAME                                       'donull'
         19        INIT_FCALL                                               'strcmp'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $12     
         23        IS_IDENTICAL                                     ~13     $12, 0
         24        SEND_VAL_EX                                              ~13
         25        DO_FCALL                                      0          
         26    >   POST_INC                                         ~15     !3
         27        IS_SMALLER                                               ~15, 50000
         28      > JMPNZ                                                    ~16, ->18
   11    29    >   INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 1
         31        DO_ICALL                                         $17     
         32        SUB                                              ~18     $17, !2
         33        CONCAT                                           ~19     ~18, '+seconds+for+strcmp'
         34        ECHO                                                     ~19
   13    35        ECHO                                                     '%0A'
   16    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 1
         38        DO_ICALL                                         $20     
         39        ASSIGN                                                   !2, $20
   17    40        ASSIGN                                                   !3, 0
   18    41      > JMP                                                      ->48
         42    >   INIT_FCALL_BY_NAME                                       'donull'
         43        CAST                                          6  ~23     !0
         44        CAST                                          6  ~24     !1
         45        IS_EQUAL                                         ~25     ~23, ~24
         46        SEND_VAL_EX                                              ~25
         47        DO_FCALL                                      0          
         48    >   POST_INC                                         ~27     !3
         49        IS_SMALLER                                               ~27, 50000
         50      > JMPNZ                                                    ~28, ->42
   19    51    >   INIT_FCALL                                               'microtime'
         52        SEND_VAL                                                 1
         53        DO_ICALL                                         $29     
         54        SUB                                              ~30     $29, !2
         55        CONCAT                                           ~31     ~30, '+seconds+for+typecasting'
         56        ECHO                                                     ~31
   21    57      > RETURN                                                   1

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

End of function donull

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.65 ms | 1400 KiB | 17 Q