3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['baz' => 7]; $b = (string) $a['foo'] ?? 'bar'; $c = (string) $a['baz'] ?? 'some thing else'; $d = (string) ($a['foo'] ?? 'bar'); var_dump($b, $c, $d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WogF7
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    6     1        FETCH_DIM_R                                      ~5      !0, 'foo'
          2        CAST                                          6  ~6      ~5
          3        COALESCE                                         ~7      ~6
          4        QM_ASSIGN                                        ~7      'bar'
          5        ASSIGN                                                   !1, ~7
    7     6        FETCH_DIM_R                                      ~9      !0, 'baz'
          7        CAST                                          6  ~10     ~9
          8        COALESCE                                         ~11     ~10
          9        QM_ASSIGN                                        ~11     'some+thing+else'
         10        ASSIGN                                                   !2, ~11
    8    11        FETCH_DIM_IS                                     ~13     !0, 'foo'
         12        COALESCE                                         ~14     ~13
         13        QM_ASSIGN                                        ~14     'bar'
         14        CAST                                          6  ~15     ~14
         15        ASSIGN                                                   !3, ~15
   10    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.95 ms | 997 KiB | 14 Q