3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &test($a) { $empty = []; return isset($a) ? $a : $empty; } function &test2($a) { $empty = []; return ${isset($a) ? 'a' : 'empty'}; } $test =& test('123'); print_r($test); $test =& test2('123'); print_r($test); $test =& test(NULL); print_r($test); $test =& test2(NULL); print_r($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/42Cq9
function name:  (null)
number of ops:  29
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 '123'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN_REF                                               !0, $1
   14     4        INIT_FCALL                                               'print_r'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   16     7        INIT_FCALL                                               'test2'
          8        SEND_VAL                                                 '123'
          9        DO_FCALL                                      0  $4      
         10        ASSIGN_REF                                               !0, $4
   17    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'test'
         15        SEND_VAL                                                 null
         16        DO_FCALL                                      0  $7      
         17        ASSIGN_REF                                               !0, $7
   21    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   23    21        INIT_FCALL                                               'test2'
         22        SEND_VAL                                                 null
         23        DO_FCALL                                      0  $10     
         24        ASSIGN_REF                                               !0, $10
   24    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Return found
Branch analysis from position: 6
Return found
filename:       /in/42Cq9
function name:  test
number of ops:  9
compiled vars:  !0 = $a, !1 = $empty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ISSET_ISEMPTY_CV                                         !0
          3      > JMPZ                                                     ~3, ->6
          4    >   QM_ASSIGN                                        ~4      !0
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~4      !1
          7    > > RETURN_BY_REF                                            ~4
    6     8*     > RETURN_BY_REF                                            null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Return found
Branch analysis from position: 6
Return found
filename:       /in/42Cq9
function name:  test2
number of ops:  10
compiled vars:  !0 = $a, !1 = $empty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, <array>
   10     2        ISSET_ISEMPTY_CV                                         !0
          3      > JMPZ                                                     ~3, ->6
          4    >   QM_ASSIGN                                        ~4      'a'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~4      'empty'
          7    >   FETCH_W                      local               $5      ~4
          8      > RETURN_BY_REF                                            $5
   11     9*     > RETURN_BY_REF                                            null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.97 ms | 1403 KiB | 19 Q