3v4l.org

run code in 300+ PHP versions simultaneously
<?php $n=999999; $a=1; $b=2; $start=microtime(1); for($i=1;$i<=$n;$i++) { if ($a!=$b) $c=$a+$b;else $c=8; } print 'normal: '.(microtime(1)-$start)."\n"; $start=microtime(1); for($i=1;$i<=$n;$i++) { $c=($a!=$b)?($a+$b):8; } print 'ternary: '.(microtime(1)-$start)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
Branch analysis from position: 31
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
Branch analysis from position: 31
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/08Nsd
function name:  (null)
number of ops:  49
compiled vars:  !0 = $n, !1 = $a, !2 = $b, !3 = $start, !4 = $i, !5 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 999999
    4     1        ASSIGN                                                   !1, 1
    5     2        ASSIGN                                                   !2, 2
    7     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !3, $9
    9     7        ASSIGN                                                   !4, 1
          8      > JMP                                                      ->16
   10     9    >   IS_NOT_EQUAL                                             !1, !2
         10      > JMPZ                                                     ~12, ->14
         11    >   ADD                                              ~13     !1, !2
         12        ASSIGN                                                   !5, ~13
         13      > JMP                                                      ->15
         14    >   ASSIGN                                                   !5, 8
    9    15    >   PRE_INC                                                  !4
         16    >   IS_SMALLER_OR_EQUAL                                      !4, !0
         17      > JMPNZ                                                    ~17, ->9
   13    18    >   INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $18     
         21        SUB                                              ~19     $18, !3
         22        CONCAT                                           ~20     'normal%3A+', ~19
         23        CONCAT                                           ~21     ~20, '%0A'
         24        ECHO                                                     ~21
   15    25        INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $22     
         28        ASSIGN                                                   !3, $22
   17    29        ASSIGN                                                   !4, 1
         30      > JMP                                                      ->39
   18    31    >   IS_NOT_EQUAL                                             !1, !2
         32      > JMPZ                                                     ~25, ->36
         33    >   ADD                                              ~26     !1, !2
         34        QM_ASSIGN                                        ~27     ~26
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~27     8
         37    >   ASSIGN                                                   !5, ~27
   17    38        PRE_INC                                                  !4
         39    >   IS_SMALLER_OR_EQUAL                                      !4, !0
         40      > JMPNZ                                                    ~30, ->31
   21    41    >   INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 1
         43        DO_ICALL                                         $31     
         44        SUB                                              ~32     $31, !3
         45        CONCAT                                           ~33     'ternary%3A+', ~32
         46        CONCAT                                           ~34     ~33, '%0A'
         47        ECHO                                                     ~34
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.55 ms | 1400 KiB | 15 Q