3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = 'one|two|three|four|eeee|tttt|gggg'; // positive limit print_r(explode('|', $str, 4)); // negative limit (since PHP 5.1) print_r(explode('|', $str, -2));
Output for 5.1.0 - 7.1.0
Array ( [0] => one [1] => two [2] => three [3] => four|eeee|tttt|gggg ) Array ( [0] => one [1] => two [2] => three [3] => four [4] => eeee )
Output for 4.3.0 - 5.0.5
Array ( [0] => one [1] => two [2] => three [3] => four|eeee|tttt|gggg ) Array ( [0] => one [1] => two|three|four|eeee|tttt|gggg )