3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare_behaviour($arg1, $arg2) { static $test = 0; ++$test; $res1 = ($arg1 ?: $arg2); $res2 = ($arg1 or $arg2); echo "$test\n========\n"; if( $res1 === $res2 ){ var_dump($arg1, $arg2, $res1, $res2); } } compare_behaviour(false, true); compare_behaviour(0, 1); compare_behaviour(0, 0); compare_behaviour(NULL, []);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nlrN0
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'compare_behaviour'
          1        SEND_VAL                                                 <false>
          2        SEND_VAL                                                 <true>
          3        DO_FCALL                                      0          
   17     4        INIT_FCALL                                               'compare_behaviour'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 1
          7        DO_FCALL                                      0          
   18     8        INIT_FCALL                                               'compare_behaviour'
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 0
         11        DO_FCALL                                      0          
   19    12        INIT_FCALL                                               'compare_behaviour'
         13        SEND_VAL                                                 null
         14        SEND_VAL                                                 <array>
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function compare_behaviour:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 9
filename:       /in/nlrN0
function name:  compare_behaviour
number of ops:  22
compiled vars:  !0 = $arg1, !1 = $arg2, !2 = $test, !3 = $res1, !4 = $res2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        BIND_STATIC                                              !2
    5     3        PRE_INC                                                  !2
    7     4        JMP_SET                                          ~6      !0, ->6
          5        QM_ASSIGN                                        ~6      !1
          6        ASSIGN                                                   !3, ~6
    8     7      > JMPNZ_EX                                         ~8      !0, ->9
          8    >   BOOL                                             ~8      !1
          9    >   ASSIGN                                                   !4, ~8
   10    10        NOP                                                      
         11        FAST_CONCAT                                      ~10     !2, '%0A%3D%3D%3D%3D%3D%3D%3D%3D%0A'
         12        ECHO                                                     ~10
   11    13        IS_IDENTICAL                                             !3, !4
         14      > JMPZ                                                     ~11, ->21
   12    15    >   INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !3
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
   14    21    > > RETURN                                                   null

End of function compare_behaviour

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.48 ms | 1394 KiB | 19 Q