3v4l.org

run code in 300+ PHP versions simultaneously
<?php $row = new stdClass; $field_name = 'field_my_field'; $delta = 0; $row->$field_name[$delta] = 'value'; // This works just fine. echo 'field_name by itself: ' . $row->$field_name[0]; $f = $field_name . ':title'; $row->$f[$delta] = 'value'; // This doesn't work. echo "\n1: " . $row->$field_name[0]; var_dump($row);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6S1nV
function name:  (null)
number of ops:  25
compiled vars:  !0 = $row, !1 = $field_name, !2 = $delta, !3 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    3     3        ASSIGN                                                   !1, 'field_my_field'
    4     4        ASSIGN                                                   !2, 0
    6     5        FETCH_OBJ_W                                      $9      !0, !1
          6        ASSIGN_DIM                                               $9, !2
          7        OP_DATA                                                  'value'
    7     8        FETCH_OBJ_R                                      ~11     !0, !1
          9        FETCH_DIM_R                                      ~12     ~11, 0
         10        CONCAT                                           ~13     'field_name+by+itself%3A+', ~12
         11        ECHO                                                     ~13
    9    12        CONCAT                                           ~14     !1, '%3Atitle'
         13        ASSIGN                                                   !3, ~14
   10    14        FETCH_OBJ_W                                      $16     !0, !3
         15        ASSIGN_DIM                                               $16, !2
         16        OP_DATA                                                  'value'
   11    17        FETCH_OBJ_R                                      ~18     !0, !1
         18        FETCH_DIM_R                                      ~19     ~18, 0
         19        CONCAT                                           ~20     '%0A1%3A+', ~19
         20        ECHO                                                     ~20
   12    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.25 ms | 1395 KiB | 15 Q