3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = '0'; $b = '1'; $b2 = 1; $b3 = true; $c = ''; $c2 = false; $c3 = null; $d = '-1'; $e = '2'; $f = 'abc'; function test($a) { if (!$a) { $a = 0; } if ($a != 1) { echo '1' . " "; } else { echo '0' . " "; } } function test2($a) { $a = (bool)$a; if (!$a) { echo '1' . "\n"; } else { echo '0' . "\n"; } } test($a);test2($a); test($b);test2($b); test($b2);test2($b2); test($b3);test2($b3); test($c);test2($c); test($c2);test2($c2); test($c3);test2($c3); test($d);test2($d); test($e);test2($e); test($f);test2($f);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6C8W9
function name:  (null)
number of ops:  71
compiled vars:  !0 = $a, !1 = $b, !2 = $b2, !3 = $b3, !4 = $c, !5 = $c2, !6 = $c3, !7 = $d, !8 = $e, !9 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '0'
    3     1        ASSIGN                                                       !1, '1'
    4     2        ASSIGN                                                       !2, 1
    5     3        ASSIGN                                                       !3, <true>
    6     4        ASSIGN                                                       !4, ''
    7     5        ASSIGN                                                       !5, <false>
    8     6        ASSIGN                                                       !6, null
    9     7        ASSIGN                                                       !7, '-1'
   10     8        ASSIGN                                                       !8, '2'
   11     9        ASSIGN                                                       !9, 'abc'
   35    10        INIT_FCALL                                                   'test'
         11        SEND_VAR                                                     !0
         12        DO_FCALL                                          0          
         13        INIT_FCALL                                                   'test2'
         14        SEND_VAR                                                     !0
         15        DO_FCALL                                          0          
   36    16        INIT_FCALL                                                   'test'
         17        SEND_VAR                                                     !1
         18        DO_FCALL                                          0          
         19        INIT_FCALL                                                   'test2'
         20        SEND_VAR                                                     !1
         21        DO_FCALL                                          0          
   37    22        INIT_FCALL                                                   'test'
         23        SEND_VAR                                                     !2
         24        DO_FCALL                                          0          
         25        INIT_FCALL                                                   'test2'
         26        SEND_VAR                                                     !2
         27        DO_FCALL                                          0          
   38    28        INIT_FCALL                                                   'test'
         29        SEND_VAR                                                     !3
         30        DO_FCALL                                          0          
         31        INIT_FCALL                                                   'test2'
         32        SEND_VAR                                                     !3
         33        DO_FCALL                                          0          
   39    34        INIT_FCALL                                                   'test'
         35        SEND_VAR                                                     !4
         36        DO_FCALL                                          0          
         37        INIT_FCALL                                                   'test2'
         38        SEND_VAR                                                     !4
         39        DO_FCALL                                          0          
   40    40        INIT_FCALL                                                   'test'
         41        SEND_VAR                                                     !5
         42        DO_FCALL                                          0          
         43        INIT_FCALL                                                   'test2'
         44        SEND_VAR                                                     !5
         45        DO_FCALL                                          0          
   41    46        INIT_FCALL                                                   'test'
         47        SEND_VAR                                                     !6
         48        DO_FCALL                                          0          
         49        INIT_FCALL                                                   'test2'
         50        SEND_VAR                                                     !6
         51        DO_FCALL                                          0          
   42    52        INIT_FCALL                                                   'test'
         53        SEND_VAR                                                     !7
         54        DO_FCALL                                          0          
         55        INIT_FCALL                                                   'test2'
         56        SEND_VAR                                                     !7
         57        DO_FCALL                                          0          
   43    58        INIT_FCALL                                                   'test'
         59        SEND_VAR                                                     !8
         60        DO_FCALL                                          0          
         61        INIT_FCALL                                                   'test2'
         62        SEND_VAR                                                     !8
         63        DO_FCALL                                          0          
   44    64        INIT_FCALL                                                   'test'
         65        SEND_VAR                                                     !9
         66        DO_FCALL                                          0          
         67        INIT_FCALL                                                   'test2'
         68        SEND_VAR                                                     !9
         69        DO_FCALL                                          0          
         70      > RETURN                                                       1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/6C8W9
function name:  test
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   14     1        BOOL_NOT                                             ~1      !0
          2      > JMPZ                                                         ~1, ->4
   15     3    >   ASSIGN                                                       !0, 0
   17     4    >   IS_NOT_EQUAL                                                 !0, 1
          5      > JMPZ                                                         ~3, ->8
   18     6    >   ECHO                                                         '1+'
   17     7      > JMP                                                          ->9
   20     8    >   ECHO                                                         '0+'
   22     9    > > RETURN                                                       null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6C8W9
function name:  test2
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   RECV                                                 !0      
   25     1        BOOL                                                 ~1      !0
          2        ASSIGN                                                       !0, ~1
   27     3        BOOL_NOT                                             ~3      !0
          4      > JMPZ                                                         ~3, ->7
   28     5    >   ECHO                                                         '1%0A'
   27     6      > JMP                                                          ->8
   30     7    >   ECHO                                                         '0%0A'
   32     8    > > RETURN                                                       null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.7 ms | 498 KiB | 20 Q