note 104130 added to simplexmlelement.count
| From: | surgatus at gmail dot com | Date: | Wed, 25 May 2011 12:03:12 +0000 |
| Subject: | note 104130 added to simplexmlelement.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180017@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 195.54.192.44
Probable Submitter: 127.0.0.1
----
Manual Page -- http://www.php.net/manual/en/simplexmlelement.count.php
Edit -- https://master.php.net/note/edit/104130
Del: integrated -- https://master.php.net/note/delete/104130/integrated
Del: useless -- https://master.php.net/note/delete/104130/useless
Del: bad code -- https://master.php.net/note/delete/104130/bad+code
Del: spam -- https://master.php.net/note/delete/104130/spam
Del: non-english -- https://master.php.net/note/delete/104130/non-english
Del: in docs -- https://master.php.net/note/delete/104130/in+docs
Del: other reasons-- https://master.php.net/note/delete/104130
Reject -- https://master.php.net/note/reject/104130
Search -- https://master.php.net/manage/user-notes.php