3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = 'Title: Wonderful World ---- Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed facilisis nulla dui, etiaculis enim porta aliquet. Etiam ante mauris, luctus non ultricies ut, pellentesque non eros. <b>Pellentesque</b> sit amet eros in quam pharetra fermentum quis ac lacus. Maecenas turpis purus, molestie eu quam non, adipiscing hendrerit nibh. Go to <a href="/">Main Site</a> ---- Image: mysite.com/images/logo.png'; $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 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Array ( [Title] => Wonderful World [Text] => Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed facilisis nulla dui, etiaculis enim porta aliquet. Etiam ante mauris, luctus non ultricies ut, pellentesque non eros. <b>Pellentesque</b> sit amet eros in quam pharetra fermentum quis ac lacus. Maecenas turpis purus, molestie eu quam non, adipiscing hendrerit nibh. Go to <a href="/">Main Site</a> [Image] => mysite.com/images/logo.png )
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/T84dd on line 23 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/T84dd on line 23 Array ( [Title] => Wonderful World ---- Text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed facilisis nulla dui, etiaculis enim porta aliquet. Etiam ante mauris, luctus non ultricies ut, pellentesque non eros. <b>Pellentesque</b> sit amet eros in quam pharetra fermentum quis ac lacus. Maecenas turpis purus, molestie eu quam non, adipiscing hendrerit nibh. Go to <a href="/">Main Site</a> ---- Image: mysite.com/images/logo.png )