php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51553 bug in simplexmlelement count example
Submitted: 2010-04-14 00:37 UTC Modified: 2010-04-14 01:08 UTC
From: sarahnorthway at gmail dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2010-04-14 00:37 UTC] sarahnorthway at gmail dot com
Description:
------------
In the examples for simplexmlelement->count at http://www.php.net/manual/en/simplexmlelement.count.php, the line:

foreach ($elem as $person) {

should be:

foreach ($elem->children() as $person) {


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-14 01:08 UTC] degeberg@php.net
-Status: Open +Status: Bogus
 [2010-04-14 01:08 UTC] degeberg@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

That's not necessary. Did you actually run the code? :)

When you iterate over a SimpleXML element, it's its children you'll get. What else should it be?

daniel@daniel-laptop:~$ php -v; php test.php
PHP 5.3.3-dev (cli) (built: Mar 29 2010 15:35:44) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans
Person 1 has got 3 children.
Person 2 has got 5 children.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC