3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.66 ms | 1392 KiB | 19 Q