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 )



[...] Step 4: In the php file the string will be split back into array. How can I split the string using php? clik here [...]
In case when the items are separated with commas followed by random number of spaces, e.g. “apples, roses” it may be usefull to use regular expressions:
var_dump(preg_split(‘/\s*,\s*/’, ‘apples, roses’));
or apply trim function on the result array:
var_dump(array_map(‘trim’, preg_split(‘/\s*,\s*/’, ‘apples, roses’)));
thank’s alex for this reply
hi
cGLnu9 comment5 ,