3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { echo $foo->bar ?? null; } function test2() { echo isset($foo->bar) ? $foo->bar : null; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JXul7
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JXul7
function name:  test
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_OBJ_IS                                     ~1      !0, 'bar'
          1        COALESCE                                         ~2      ~1
          2        QM_ASSIGN                                        ~2      null
          3        ECHO                                                     ~2
    5     4      > RETURN                                                   null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JXul7
function name:  test2
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ISSET_ISEMPTY_PROP_OBJ                                   !0, 'bar'
          1      > JMPZ                                                     ~1, ->5
          2    >   FETCH_OBJ_R                                      ~2      !0, 'bar'
          3        QM_ASSIGN                                        ~3      ~2
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~3      null
          6    >   ECHO                                                     ~3
    9     7      > RETURN                                                   null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.49 ms | 1433 KiB | 13 Q