3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cases = array(false, 0, 1, 2, 3, 4, 5, true, null); foreach ($cases as $c) { $s = microtime(true); $doC = !!$c; var_dump('time : ' . (microtime(true) - $s) . ' for !!$c, result:', $doC); $s = microtime(true); $doC = (bool)$c; var_dump('time : ' . (microtime(true) - $s) . ' for (bool)$c, result:', $doC); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 37
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 37
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/QTXrG
function name:  (null)
number of ops:  39
compiled vars:  !0 = $cases, !1 = $c, !2 = $s, !3 = $doC
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1      > FE_RESET_R                                       $5      !0, ->37
          2    > > FE_FETCH_R                                               $5, !1, ->37
    4     3    >   INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
    5     7        BOOL_NOT                                         ~8      !1
          8        BOOL_NOT                                         ~9      ~8
          9        ASSIGN                                                   !3, ~9
    6    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $11     
         14        SUB                                              ~12     $11, !2
         15        CONCAT                                           ~13     'time+%3A+', ~12
         16        CONCAT                                           ~14     ~13, '+for+%21%21%24c%2C+result%3A'
         17        SEND_VAL                                                 ~14
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                                 
    8    20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !2, $16
    9    24        BOOL                                             ~18     !1
         25        ASSIGN                                                   !3, ~18
   10    26        INIT_FCALL                                               'var_dump'
         27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $20     
         30        SUB                                              ~21     $20, !2
         31        CONCAT                                           ~22     'time+%3A+', ~21
         32        CONCAT                                           ~23     ~22, '+for+%28bool%29%24c%2C+result%3A'
         33        SEND_VAL                                                 ~23
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                                 
    3    36      > JMP                                                      ->2
         37    >   FE_FREE                                                  $5
   11    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.09 ms | 1396 KiB | 17 Q