|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-31 05:22 UTC] yohgaki@php.net
-Status: Open
+Status: Not a bug
-Package: domxml
+Package: *General Issues
[2013-07-31 05:22 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
Description: ------------ PHP is 5.0.2 firstly, it wasn't in the list, so I just chose the cvs version. I am trying to count how many nodes are under another node in an xml document by counting them with count(). For some reason, even when I have more than one node, it always returns 1. Same with the children() function. Basically in my code, I'm trying to prove that Order->OrderLines['NumLines'] == count(Order->OrderLines->OrderLine) Reproduce code: --------------- XML Fragment: <Order> <OrderLines NumLines="2"> <OrderLine Number="1" StampID="435" Quantity="2" /> <OrderLine Number="2" StampID="733" Quantity="5" /> </OrderLines> </Order> PHP Code; $order = $xml->Order; // set previously count($order->OrderLines->children())) or count($order->OrderLines->OrderLine) Expected result: ---------------- 2 Actual result: -------------- 1