perl developer struggling with some php concepts
| From: | Vincent Stoessel | Date: | Tue, 19 Dec 2000 20:50:35 +0000 |
| Subject: | perl developer struggling with some php concepts | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31058@lists.php.net to get a copy of this message | ||
Hello,
I'm forwarding this question to the group from a perl developer
trying to grasp array concepts in php vs perl.
His statement follows:
Something anamolous in php: finding the highest index of an array is
non-trivial. There should be some method available that tells what the highest index of an array is. In the first example it should be two, in the second example it should be 12.If anyone finds an answer to this, please share it with the group. This should be pretty basic. http://www.php.net/manual/function.count.php Example 1. Count() example $a[0] = 1; $a[1] = 3; $a[2] = 5; $result = count ($a); //$result == 3, not 2, as there are 3 assigned elements $a[2] = 1; $a[4] = ""; $a[6] = 5; $a[8] = 7; $a[10] = 11; $a[12] = ""; $result = count ($a); // $result == 4, as there are 4 assigned element Thanks in advance. -- Vincent Stoessel vince@idev.com Internet Applications Engineer IDEV http://www.idev.com