note 43888 added to function.sizeof

From: Date: Wed, 07 Jul 2004 12:25:40 +0000
Subject: note 43888 added to function.sizeof
Groups: php.notes 
Request: Send a blank email to php-notes+get-72823@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.sizeof.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43888 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43888&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43888&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72823) next »