note 43888 deleted from function.sizeof by colder
| From: | colder@php.net | Date: | Tue, 16 Jan 2007 14:19:43 +0000 |
| Subject: | note 43888 deleted from function.sizeof by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121795@lists.php.net to get a copy of this message | ||
Note Submitter: pfortin at ss2i dot ca
----
Well, I'm not very sure about the above and it seems a bit overkill if you want my opinion. I
prefer to use foreach() or the array_keys function if you only need the selected indexes ... Example
:
if(sizeof($_POST['Checkboxes']))
{
foreach($_POST['Checkboxes'] as $Index => $Value)
{
DoStuffHere();
}
}
OR
$keys = array_keys($_POST['Checkboxes']);
Using this method, you have the $Index set, which in the above exemple would be the array offset.
You can use the functions array_keys() as well which will return the keys of the array, in this case
the selected checkboxes.