|
-
May 23rd, 2005, 10:36 AM
#1
Thread Starter
Lively Member
[resolved] split string to array, then foreach
Hello all.
I am posting a string, $_POST['hotels'], which is: "2,33,22,20,21"
I would like to split that string, at the comma, into an array, converting each to a number, then doing a foreach.
I was thinking:
Code:
$hotels = split(',',$_POST['hotels']);
foreach ($hotels as $x) {
//convert $x to a number
//do something with $x
}
But I'm not doing it right.
Any help is greatly appreciated.
Many thanks.
Last edited by solitario; May 27th, 2005 at 02:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|