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.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
piece1PHP_EOLpiece2PHP_EOLfooPHP_EOL*PHP_EOL