3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo($a) { $page1 = isset($a['page']) ? $a['page'] : 1; echo 'P: ', $page1, "\n"; $page2 = $a['page'] ?? 1; echo 'P: ', $page2, "\n"; echo $page1 == $page2 ? 't' : 'n', "\n"; } $a = array('page' => 3); foo($a); $a = array(); foo($a); $a = array('page' => Null); foo($a); $a = array('page' => 0); foo($a); ?>
based on SpIav
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/WuXZ3
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  15     1        ASSIGN                                                   !0, <array>
  16     2        INIT_FCALL                                               'foo'
         3        SEND_VAR                                                 !0
         4        DO_FCALL                                      0          
  17     5        ASSIGN                                                   !0, <array>
  18     6        INIT_FCALL                                               'foo'
         7        SEND_VAR                                                 !0
         8        DO_FCALL                                      0          
  20     9        ASSIGN                                                   !0, <array>
  21    10        INIT_FCALL                                               'foo'
        11        SEND_VAR                                                 !0
        12        DO_FCALL                                      0          
  23    13        ASSIGN                                                   !0, <array>
  24    14        INIT_FCALL                                               'foo'
        15        SEND_VAR                                                 !0
        16        DO_FCALL                                      0          
        17      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
Jump found. Position 1 = 7
Branch analysis from position: 7
Jump found. Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
Jump found. Position 1 = 23
Branch analysis from position: 23
Jump found. Position 1 = -2
Branch analysis from position: 22
Jump found. Position 1 = -2
Branch analysis from position: 6
Jump found. Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
Branch analysis from position: 22
filename:       /in/WuXZ3
function name:  foo
number of ops:  26
compiled vars:  !0 = $a, !1 = $page1, !2 = $page2
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   RECV                                             !0      
   4     1        ISSET_ISEMPTY_DIM_OBJ                       33554432  ~3      !0, 'page'
         2      > JMPZ                                                     ~3, ->6
         3    >   FETCH_DIM_R                                      $4      !0, 'page'
         4        QM_ASSIGN                                        ~5      $4
         5      > JMP                                                      ->7
         6    >   QM_ASSIGN                                        ~5      1
         7    >   ASSIGN                                                   !1, ~5
   6     8        ECHO                                                     'P%3A+'
         9        ECHO                                                     !1
        10        ECHO                                                     '%0A'
   8    11        FETCH_DIM_IS                                     $7      !0, 'page'
        12        COALESCE                                         ~8      $7
        13        QM_ASSIGN                                        ~8      1
        14        ASSIGN                                                   !2, ~8
  10    15        ECHO                                                     'P%3A+'
        16        ECHO                                                     !2
        17        ECHO                                                     '%0A'
  12    18        IS_EQUAL                                         ~10     !1, !2
        19      > JMPZ                                                     ~10, ->22
        20    >   QM_ASSIGN                                        ~11     't'
        21      > JMP                                                      ->23
        22    >   QM_ASSIGN                                        ~11     'n'
        23    >   ECHO                                                     ~11
        24        ECHO                                                     '%0A'
  13    25      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 7.2.0