3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = 'Title: Wonderful World ---- Text: ......'; $result = array(); $block_sep = PHP_EOL.'----'.PHP_EOL; foreach(explode($block_sep, $text) as $block){ $block = explode(':', $block, 2); $result[trim($block[0])] = trim($block[1]); } print_r($result);
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.1.0
Array ( [Title] => Wonderful World [Text] => ...... )
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/UhiBU on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/UhiBU on line 12 Array ( [Title] => Wonderful World ---- Text: ...... )