3v4l.org

run code in 300+ PHP versions simultaneously
<?php function NC($x){ $y = array(); $y['test'] = $x; $returnThis = $y['test'] ?? "Foo"; return $returnThis; } NC(NULL); // I know this will return "Foo". /* But I have no clue about what these will return. */ var_dump(NC(0)); var_dump(NC(-1)); var_dump(NC("")); var_dump(NC(array()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GquSv
function name:  (null)
number of ops:  28
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'nc'
          1        SEND_VAL                                                 null
          2        DO_FCALL                                      0          
   12     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'nc'
          5        SEND_VAL                                                 0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   13     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'nc'
         11        SEND_VAL                                                 -1
         12        DO_FCALL                                      0  $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                                 
   14    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'nc'
         17        SEND_VAL                                                 ''
         18        DO_FCALL                                      0  $5      
         19        SEND_VAR                                                 $5
         20        DO_ICALL                                                 
   15    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'nc'
         23        SEND_VAL                                                 <array>
         24        DO_FCALL                                      0  $7      
         25        SEND_VAR                                                 $7
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function nc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GquSv
function name:  NC
number of ops:  10
compiled vars:  !0 = $x, !1 = $y, !2 = $returnThis
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN_DIM                                               !1, 'test'
          3        OP_DATA                                                  !0
    6     4        FETCH_DIM_IS                                     ~5      !1, 'test'
          5        COALESCE                                         ~6      ~5
          6        QM_ASSIGN                                        ~6      'Foo'
          7        ASSIGN                                                   !2, ~6
    7     8      > RETURN                                                   !2
    8     9*     > RETURN                                                   null

End of function nc

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.79 ms | 1399 KiB | 20 Q