3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $row = new stdClass; $field_name = 'field_my_field'; $delta = 0; $row->{$field_name} = array(); $row->{$field_name}[$delta] = 'value'; // This works just fine. echo 'field_name by itself: ' . $row->{$field_name}; $row->{$field_name . ':title'}[$delta] = 'value'; // This doesn't work. echo "\n1: " . $row->$field_name[0];
based on 7H4Kh
Output for 7.0.0 - 7.2.0
Notice: Array to string conversion in /in/2dt23 on line 8 field_name by itself: Array 1: value
Output for 5.4.9 - 5.6.28
Notice: Array to string conversion in /in/2dt23 on line 8 field_name by itself: Array Notice: Undefined property: stdClass::$f in /in/2dt23 on line 11 1:
Output for 5.3.19 - 5.3.29
field_name by itself: Array Notice: Undefined property: stdClass::$f in /in/2dt23 on line 11 1: