3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testOptional(string $hello, string|null $world = null) { return $hello . ' ' . ($world ?? 'world'); } function testNullable(string $hello, string|null $world) { return $hello . ' ' . ($world ?? 'world'); } echo testOptional('hello'), PHP_EOL; echo testNullable('hello'), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gXLDH
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'testoptional'
          1        SEND_VAL                                                 'hello'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
   14     5        INIT_FCALL                                               'testnullable'
          6        SEND_VAL                                                 'hello'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9        ECHO                                                     '%0A'
   15    10      > RETURN                                                   1

Function testoptional:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gXLDH
function name:  testOptional
number of ops:  8
compiled vars:  !0 = $hello, !1 = $world
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    4     2        CONCAT                                           ~2      !0, '+'
          3        COALESCE                                         ~3      !1
          4        QM_ASSIGN                                        ~3      'world'
          5        CONCAT                                           ~4      ~2, ~3
          6      > RETURN                                                   ~4
    5     7*     > RETURN                                                   null

End of function testoptional

Function testnullable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gXLDH
function name:  testNullable
number of ops:  8
compiled vars:  !0 = $hello, !1 = $world
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        CONCAT                                           ~2      !0, '+'
          3        COALESCE                                         ~3      !1
          4        QM_ASSIGN                                        ~3      'world'
          5        CONCAT                                           ~4      ~2, ~3
          6      > RETURN                                                   ~4
   10     7*     > RETURN                                                   null

End of function testnullable

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.44 ms | 999 KiB | 15 Q