1--TEST-- 2Test explode() function : usage variations - positive and negative limits 3--FILE-- 4<?php 5 6echo "*** Testing explode() function: positive and negative limits ***\n"; 7$str = 'one||two||three||four'; 8 9echo "\n-- positive limit --\n"; 10var_dump(explode('||', $str, 2)); 11 12echo "\n-- negative limit (since PHP 5.1) --\n"; 13var_dump(explode('||', $str, -1)); 14 15echo "\n-- negative limit (since PHP 5.1) with null string -- \n"; 16var_dump(explode('||', "", -1)); 17?> 18--EXPECT-- 19*** Testing explode() function: positive and negative limits *** 20 21-- positive limit -- 22array(2) { 23 [0]=> 24 string(3) "one" 25 [1]=> 26 string(16) "two||three||four" 27} 28 29-- negative limit (since PHP 5.1) -- 30array(3) { 31 [0]=> 32 string(3) "one" 33 [1]=> 34 string(3) "two" 35 [2]=> 36 string(5) "three" 37} 38 39-- negative limit (since PHP 5.1) with null string -- 40array(0) { 41} 42