3v4l.org

run code in 300+ PHP versions simultaneously
<?php // HEAD $element = []; $text = $element['#text']; var_dump($text); // Using ?? $element = []; $text = $element['#text'] ?? ''; var_dump($text); // Using string cast no #text $element = []; $text = (string) $element['#text']; var_dump($text); // Using string cast with #text $element = ['#text' => NULL]; $text = (string) $element['#text']; var_dump($text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UuKsj
function name:  (null)
number of ops:  29
compiled vars:  !0 = $element, !1 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        FETCH_DIM_R                                      ~3      !0, '%23text'
          2        ASSIGN                                                   !1, ~3
    6     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                                 
    9     6        ASSIGN                                                   !0, <array>
   10     7        FETCH_DIM_IS                                     ~7      !0, '%23text'
          8        COALESCE                                         ~8      ~7
          9        QM_ASSIGN                                        ~8      ''
         10        ASSIGN                                                   !1, ~8
   11    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   14    14        ASSIGN                                                   !0, <array>
   15    15        FETCH_DIM_R                                      ~12     !0, '%23text'
         16        CAST                                          6  ~13     ~12
         17        ASSIGN                                                   !1, ~13
   16    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   19    21        ASSIGN                                                   !0, <array>
   20    22        FETCH_DIM_R                                      ~17     !0, '%23text'
         23        CAST                                          6  ~18     ~17
         24        ASSIGN                                                   !1, ~18
   21    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.4 ms | 1451 KiB | 14 Q