Explode function using PHP
The explode() work breaks a string into a array.
Note: The "separator" parameter can't be an unfilled string.
Note: This function is binary-safe.
Syntax: explode(separator,string,limit)
Technical Details
Return Value: Returns an array of strings
PHP Version: 4+
Changelog: The limit parameter was included PHP 4.0.1, and support for negative limits were included PHP 5.1.0
<?php
$str = 'one,two,three,four';// zero limit
print_r(explode( ' , ' ,$str,0)); //Array ( [0] => one,two,three,four )
print "<br>";// positive limit
print_r(explode( ' , ' ,$str,2)); //Array ( [0] => one [1] => two,three,four )
print "<br>";// negative limit
print_r(explode( ' , ' ,$str,-1)); //Array ( [0] => one [1] => two [2] => three )
?>