3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); function select1(int $offset = 0) { var_dump($offset); } function select2(?int $offset = 0) { var_dump($offset); } function select3(int $offset = null) { var_dump($offset); } function select4(?int $offset = null) { // same as select3 var_dump($offset); } select1(); select1(0); // select1(null); // <------ fails select2(); select2(0); select2(null); select3(); select3(0); select3(null); select4(); select4(0); select4(null);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1dlE
function name:  (null)
number of ops:  30
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'select1'
          1        DO_FCALL                                      0          
   22     2        INIT_FCALL                                               'select1'
          3        SEND_VAL                                                 0
          4        DO_FCALL                                      0          
   25     5        INIT_FCALL                                               'select2'
          6        DO_FCALL                                      0          
   26     7        INIT_FCALL                                               'select2'
          8        SEND_VAL                                                 0
          9        DO_FCALL                                      0          
   27    10        INIT_FCALL                                               'select2'
         11        SEND_VAL                                                 null
         12        DO_FCALL                                      0          
   29    13        INIT_FCALL                                               'select3'
         14        DO_FCALL                                      0          
   30    15        INIT_FCALL                                               'select3'
         16        SEND_VAL                                                 0
         17        DO_FCALL                                      0          
   31    18        INIT_FCALL                                               'select3'
         19        SEND_VAL                                                 null
         20        DO_FCALL                                      0          
   33    21        INIT_FCALL                                               'select4'
         22        DO_FCALL                                      0          
   34    23        INIT_FCALL                                               'select4'
         24        SEND_VAL                                                 0
         25        DO_FCALL                                      0          
   35    26        INIT_FCALL                                               'select4'
         27        SEND_VAL                                                 null
         28        DO_FCALL                                      0          
         29      > RETURN                                                   1

Function select1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1dlE
function name:  select1
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      0
    6     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    7     4      > RETURN                                                   null

End of function select1

Function select2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1dlE
function name:  select2
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      0
   10     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   11     4      > RETURN                                                   null

End of function select2

Function select3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1dlE
function name:  select3
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_INIT                                        !0      null
   14     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   15     4      > RETURN                                                   null

End of function select3

Function select4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l1dlE
function name:  select4
number of ops:  5
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV_INIT                                        !0      null
   18     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   19     4      > RETURN                                                   null

End of function select4

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.62 ms | 1444 KiB | 25 Q