<?php
$colorStr = "blue:red:green:yellow";
$colors = explode(":", $colorStr, 3);
var_dump($colors);
$colors = explode(":", $colorStr, 4);
echo "<br/>";
var_dump($colors);
?>
Output:
array(3) { [0]=> string(4) "blue" [1]=> string(3) "red" [2]=> string(12) "green:yellow" }
array(4) { [0]=> string(4) "blue" [1]=> string(3) "red" [2]=> string(5) "green" [3]=> string(6) "yellow" }
No comments:
Post a Comment