3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = [ 'sortby' => '', 'default_sortby' => 'foo' ]; $before = $a['sortby'] ?: $a['default_sortby']; $after = $a['sortby'] ?? $a['default_sortby']; var_dump($before); var_dump($after);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHsh7
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a, !1 = $before, !2 = $after
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1        FETCH_DIM_R                                          ~4      !0, 'sortby'
          2        JMP_SET                                              ~5      ~4, ->5
          3        FETCH_DIM_R                                          ~6      !0, 'default_sortby'
          4        QM_ASSIGN                                            ~5      ~6
          5        ASSIGN                                                       !1, ~5
    9     6        FETCH_DIM_IS                                         ~8      !0, 'sortby'
          7        COALESCE                                             ~9      ~8
          8        FETCH_DIM_R                                          ~10     !0, 'default_sortby'
          9        QM_ASSIGN                                            ~9      ~10
         10        ASSIGN                                                       !2, ~9
   11    11        INIT_FCALL                                                   'var_dump'
         12        SEND_VAR                                                     !1
         13        DO_ICALL                                                     
   12    14        INIT_FCALL                                                   'var_dump'
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.87 ms | 491 KiB | 10 Q