EDIT3: It seems that the problem occurs on my localhost XAMPP PHP 5.3 installation, and not on any remote server running php 5.2 that I tested. It is still unclear whether its php or xampp (or maybe a combination) is causing the / EDIT 3 error
I have xml with about 12000 names to add to the array. The xml structure is as follows:
<smdusersync datetime="2010-12-13 13:51:16"> <userstoadd> <User fnamn="Adam" enamn="Svensson" email=" adam@darkeye.se " password="3906" /> <User fnamn="Brooke" enamn="Jarnbjer" email=" brooke@gmail.com " password="2729" /> <User fnamn="Caesar" enamn="Carlsson" email=" caesar@comhem.se " password="1668" /> </userstoadd> <userstoremove> </userstoremove> </smdusersync>
EDIT2: I tried with other xml examples, including programmatically generated without attbutes, etc., and it doesnβt matter - the same problem is described below ... / EDIT 2
When you start a simple foreach loop in the xml userstoadd file, strange things happen when I click objects on an array.
(Please note that the example below shows the code causing the error - this is not a very useful example)
Running a simple foreach loop (here just pushing testcounter into an array) works as expected:
$user_xml = simplexml_load_file('users.xml'); $xml_count = $user_xml->userstoadd->children()->count(); $users_arr = array(); $test_count = 0; foreach ($user_xml->userstoadd->children() as $user) { array_push($users_arr, $test_count);
$ xml_count and $ test_count always have the same value.
When I do the same, besides this, I click on a simple object on an array, everything works fine if the number of users xml <= 9940:
$user_xml = simplexml_load_file('users.xml'); $xml_count = $user_xml->userstoadd->children()->count(); $users_arr = array(); $test_count = 0; foreach ($user_xml->userstoadd->children() as $user) { $dummy_object = new StdClass();
With 9940 xml custom elements, the result is expected to be 9940/9940 . BUT in the presence of 9941 xml of user elements an exit 9941/19881 ! And having 9942 xml custom elements, exit 9942/19882!
Suddenly almost 10,000 difference! And the content of the user elements does not seem to matter ... I copied and moved the xml user elements with the same result ...
EDIT: When more than 9940 items, it suddenly doubles, so 9941 points gives (9940 x 2) + 1 = 19881. There is no difference when using one xml user element 12000 times. / EDIT
Any idea what is going on here?