note 61809 deleted from function.sizeof by colder

From: Date: Tue, 16 Jan 2007 14:19:36 +0000
Subject: note 61809 deleted from function.sizeof by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121794@lists.php.net to get a copy of this message
Note Submitter: blasterncs at hotmail dot com ---- In some cases you can use this. <FORM ACTION="receiver.php" METHOD=POST> <INPUT TYPE=CHECKBOX NAME="arreglo[]" value="1">Thing #1 <INPUT TYPE=CHECKBOX NAME="arreglo[]" value="2">Thing #2 <INPUT TYPE=CHECKBOX NAME="arreglo[]" value="3">Thing #1 <INPUT TYPE=CHECKBOX NAME="arreglo[]" value="4">Thing #4 <INPUT TYPE=SUBMIT> </FORM> In the case you mark two (1 & 3) you will have that result: sizeof($_POST[arreglo]) -> 2 the different is that you can use: for($i=0; $i<sizeof($_POST[arreglo]); $i++) Because the array is like that: $_POST[arreglo]=array( '0'=> '1', '1' => '3'); Another thing. If you have an array with null values, use this: count(array_keys($array));

« previous php.notes (#121794) next »