3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $node = (object) array( 'nid' => 5, ); $data = array( 'subject' => 'subject', 'content' => 'Some string', ); // For some cases rewrite the content if ($node->nid > 5) { $content = $data['content'] . '<ul><li>List</li><li>with</li><li>some</li><li>items</li>'; $data['content'] = array( 'markup' => $content, '#attached' => array( 'js' => array( 'some_file.js', ), ), ); } if (!isset($data['content']) && !array_key_exists('markup', $data['content']) && !isset($data['content']['markup'])) { $data['content'] = array( 'markup' => $data['content'], ); } print_r($data); // Really? var_dump($data['content']['markup']);
based on Vg2pa
Output for 5.4.0 - 7.2.0
Array ( [subject] => subject [content] => Some string ) Warning: Illegal string offset 'markup' in /in/chiVg on line 35 string(1) "S"
Output for 4.3.0 - 5.3.29
Array ( [subject] => subject [content] => Some string ) string(1) "S"