3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ null, [], ['foo'] ]; foreach ($tests as $test) { echo "\n--------------\n" . var_export($test, true) . " has a boolean value of: " . var_export((bool)$test, true) . " - "; if ($test) { echo "pass"; } else { echo "fail"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/WLRk5
function name:  (null)
number of ops:  24
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_R                                       $3      !0, ->22
          2    > > FE_FETCH_R                                               $3, !1, ->22
   10     3    >   INIT_FCALL                                               'var_export'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $4      
          7        CONCAT                                           ~5      '%0A--------------%0A', $4
          8        CONCAT                                           ~6      ~5, '+has+a+boolean+value+of%3A+'
          9        INIT_FCALL                                               'var_export'
         10        BOOL                                             ~7      !1
         11        SEND_VAL                                                 ~7
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $8      
         14        CONCAT                                           ~9      ~6, $8
         15        CONCAT                                           ~10     ~9, '+-+'
         16        ECHO                                                     ~10
   11    17      > JMPZ                                                     !1, ->20
   12    18    >   ECHO                                                     'pass'
         19      > JMP                                                      ->21
   14    20    >   ECHO                                                     'fail'
    9    21    > > JMP                                                      ->2
         22    >   FE_FREE                                                  $3
   16    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.83 ms | 1395 KiB | 15 Q