Re[2]: [PHP4BETA] count($array,1) or count($array)
| From: | php_list at citiz dot net | Date: | Tue, 23 May 2000 04:36:11 +0000 |
| Subject: | Re[2]: [PHP4BETA] count($array,1) or count($array) | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-15397@lists.php.net to get a copy of this message | ||
Hello Cynic,
Monday, May 22, 2000, 5:58:03 AM, you wrote:
C> I don't understand what you ask about. Can you rephrase your
C> question?
C> --------------------------------------------------------------
>>Hello ,
>>
>> I never see count($array,1) in doc, but someone to use it.
>> count($array) unlikeness count($array) ??
>>
>> Thanks fou you help!
>>
At http://www.zend.com/tips/tips.php?id=18&single=1
have this code:
############################################
<?
function uniqueArray($array)
{
// Get unique elts as keys in assoc. array
for ($i=0,$n=count($array, 1);$i<$n;$i++)
$u_array[$array[$i]] = 1;
// Copy keys only into another array
reset($u_array, 1);
for ($i=0,$n=count($u_array, 1);$i<$n;$i++) {
$unduplicated_array[] = key($u_array, 1);
next($u_array, 1);
}
return $unduplicated_array;
}
?>
############################################
At php4 doc function count():
############################################
count -- count elements in a variable
Description
int count(mixed var);
Returns the number of elements in var, which is typically an array (since anything else will have
one element).
Returns 1 if the variable is not an array.
Returns 0 if the variable is not set.
###########################################
The "count($u_array, 1)" and "count($u_array)" is what mean ?
I am sorry for my english so poor !
--
Best regards,
php mailto:php_list@citiz.net