3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $s1 = 'abc|def'; $s2 = 'abc|def|gh'; $s3 = 'abc|def|gh|ijk'; var_dump(explode('|', $s1, 3)); var_dump(explode('|', $s2, 3)); var_dump(explode('|', $s3, 3));
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [0]=> string(3) "abc" [1]=> string(3) "def" } array(3) { [0]=> string(3) "abc" [1]=> string(3) "def" [2]=> string(2) "gh" } array(3) { [0]=> string(3) "abc" [1]=> string(3) "def" [2]=> string(6) "gh|ijk" }