3v4l.org

run code in 300+ PHP versions simultaneously
<?php $row = new stdClass; $field_name = 'field_my_field'; $delta = 0; $row->$field_name = []; $row->$field_name[$delta] = 'value'; // This works just fine. $f = $field_name . ':title'; $row->$f = []; $row->$f[$delta] = 'value'; // This doesn't work. var_dump($row);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dX9OJ
function name:  (null)
number of ops:  21
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        ASSIGN_OBJ                                               !0, !1
          6        OP_DATA                                                  <array>
    8     7        FETCH_OBJ_W                                      $10     !0, !1
          8        ASSIGN_DIM                                               $10, !2
          9        OP_DATA                                                  'value'
   10    10        CONCAT                                           ~12     !1, '%3Atitle'
         11        ASSIGN                                                   !3, ~12
   11    12        ASSIGN_OBJ                                               !0, !3
         13        OP_DATA                                                  <array>
   12    14        FETCH_OBJ_W                                      $15     !0, !3
         15        ASSIGN_DIM                                               $15, !2
         16        OP_DATA                                                  'value'
   14    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.39 ms | 1395 KiB | 15 Q