note 104130 rejected from simplexmlelement.count by danbrown
| From: | danbrown@php.net | Date: | Wed, 25 May 2011 13:35:34 +0000 |
| Subject: | note 104130 rejected from simplexmlelement.count by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180024@lists.php.net to get a copy of this message | ||
Note Submitter: surgatus at gmail dot com
----
PHP 5.3.6
xml = <<<EOF
<people>
<person name="Person 1">
<child/>
<child/>
<child/>
</person>
</people>
EOF;
$elem = new SimpleXMLElement($xml);
$person = $elem->person;
printf("%s has got %d children.\n", $person['name'], $person->count());
print:
Person 1 has got 1 children.
foreach ($elem as $person)
printf("%s has got %d children.\n", $person['name'], $person->count());
print:
Person 1 has got 3 children.
Bug?