|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchessimplexml-patch (last revision 2012-04-30 20:58 UTC by felipe@php.net)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2012-04-30 20:58 UTC] felipe@php.net
[2020-03-27 01:04 UTC] carusogabriel@php.net
[2021-08-18 17:08 UTC] cmb@php.net
-Summary: Array key not casted to Integer.
+Summary: Float keys not cast to int like with array
-Status: Open
+Status: Verified
-Type: Bug
+Type: Documentation Problem
[2021-08-18 17:08 UTC] cmb@php.net
[2022-11-29 06:53 UTC] samanre32 at gmail dot com
[2023-06-16 09:48 UTC] bethanders at aol dot com
[2024-07-12 10:08 UTC] krina234pestro at outlook dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Description: ------------ PHP Array manual: "Floats are also cast to integers, which means that the fractional part will be truncated. E.g. the key 8.7 will actually be stored under 8." But this rule is ignored by SimpleXML object's array. Test script: --------------- $xml = simplexml_load_string("<xml><number>0</number><number>1</number></xml>"); $i = (int) 1; $d = (float) 1; $xml->number[$d] = 999; echo $xml->number[$d] .", ". $xml->number[$i]; Expected result: ---------------- 999, 999 Actual result: -------------- 999, 1