php string problem
hi i have a string containting values i.e. Acton $ 80 Ajax $ 80 Aldershot $ 80 Alliston $ 115 Alton $开发者_如何学编程 80 Aldershot $ 84 Alexandria $ 674
i want to make Acton Ajax so on.
please help
try this
explode(" ",$urStringVar)
explode will return array
good luck
$prices = explode(' ', '$34 $67 ...');
You can also use:
$myarray = str_split($mystring);
this would split your string into an array. Optionally you can specify the length of each element of the array, for example:
$myarray = str_split($mystring,3);
this would divide the string in chunks of 3 characters.
精彩评论