3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = trim('-1'); echo $str . "\n"; if ($str) { echo "option 1: not empty\n"; } if (strlen($str)) { echo "option 2: not empty\n"; } if (!empty($str)) { echo "option 3: not empty\n"; } if ($str !== '') { echo "option 4: not empty\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 8
filename:       /in/4OBH1
function name:  (null)
number of ops:  19
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'trim'
          1        SEND_VAL                                                 '-1'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
    4     4        CONCAT                                           ~3      !0, '%0A'
          5        ECHO                                                     ~3
    6     6      > JMPZ                                                     !0, ->8
    7     7    >   ECHO                                                     'option+1%3A+not+empty%0A'
   10     8    >   STRLEN                                           ~4      !0
          9      > JMPZ                                                     ~4, ->11
   11    10    >   ECHO                                                     'option+2%3A+not+empty%0A'
   14    11    >   ISSET_ISEMPTY_CV                                 ~5      !0
         12        BOOL_NOT                                         ~6      ~5
         13      > JMPZ                                                     ~6, ->15
   15    14    >   ECHO                                                     'option+3%3A+not+empty%0A'
   18    15    >   IS_NOT_IDENTICAL                                         !0, ''
         16      > JMPZ                                                     ~7, ->18
   19    17    >   ECHO                                                     'option+4%3A+not+empty%0A'
   20    18    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.93 ms | 1395 KiB | 15 Q