|
|
String Tokens / Splitting string
|
|
Topic |
How can I split the string using php?
|
|
Explanation |
Let us consider we get a value from a post actionone,two,three i.e: $ss = $_POST['arv'];
Now using the php method explode() we will convert the string in to a array object explode(seperator,string); i.e. $tok = explode(',',$ss);
so we have got a string array. Now we print the array using print_r() method.
This method prints the array in string format.
print_r($tok);
The result
Array
(
[0] => one
[1] => two
[2] => three
)
|
|
|
|
|
|