3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Example 1 $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 echo PHP_EOL; echo $pieces[1]; // piece2 echo PHP_EOL; // Example 2 $data = "foo:*:1023:1000::/home/foo:/bin/sh"; list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data); echo $user; // foo echo PHP_EOL; echo $pass; // * echo PHP_EOL; ?>
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
piece1 piece2 foo *
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
piece1 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/jm0u2 on line 6 PHP_EOLpiece2 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/jm0u2 on line 8 PHP_EOLfoo Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/jm0u2 on line 14 PHP_EOL* Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/jm0u2 on line 16 PHP_EOL