note 74270 added to function.count
| From: | david_kw at osu1 dot php dot net | Date: | Tue, 03 Apr 2007 04:43:48 +0000 |
| Subject: | note 74270 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125025@lists.php.net to get a copy of this message | ||
@bobo: Try again. Couple bugs in your example.
<?php
class A{
private $arr_of_objs = array();
public function __construct(){
$this->arr_of_objs[0] = new SomeClass();
$this->arr_of_objs[1] = new SomeClass();
}
public function getNumOfObjs(){
echo count($this->arr_of_objs); // This returns 2
echo "<br>";
echo sizeof($this->arr_of_objs); // This also returns 2.
}
}
$myObj = new A();
$myObj->getNumOfObjs();
?>
It appears that count and sizeof are actually the same in this instance as the manual says.
----
Server IP: 69.39.81.135
Probable Submitter: 71.131.14.7
----
Manual Page -- http://www.php.net/manual/en/function.count.php
Edit -- https://master.php.net/note/edit/74270
Del: integrated -- https://master.php.net/note/delete/74270/integrated
Del: useless -- https://master.php.net/note/delete/74270/useless
Del: bad code -- https://master.php.net/note/delete/74270/bad+code
Del: spam -- https://master.php.net/note/delete/74270/spam
Del: non-english -- https://master.php.net/note/delete/74270/non-english
Del: in docs -- https://master.php.net/note/delete/74270/in+docs
Del: other reasons-- https://master.php.net/note/delete/74270
Reject -- https://master.php.net/note/reject/74270
Search -- https://master.php.net/manage/user-notes.php