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']['markup'])) { $data['content'] = array( 'markup' => $data['content'], ); } print_r($data); // Really? var_dump($data['content']['#markup']);
based on eiiid
Output for 5.4.0 - 7.2.0
Array ( [subject] => subject [content] => Array ( [markup] => Some string ) ) Notice: Undefined index: #markup in /in/MqDNW on line 35 NULL
Output for 4.3.0 - 4.4.9, 5.0.3 - 5.3.29
Array ( [subject] => subject [content] => Some string ) string(1) "S"
Output for 5.0.0 - 5.0.2
Array ( [subject] => subject [content] => Array ( [markup] => Some string ) ) Notice: Undefined index: #markup in /in/MqDNW on line 35 NULL