|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-06-10 13:54 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2017-06-10 13:54 UTC] requinix@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
Description: ------------ When converting stdClass objects to arrays (e.g. from json_decode()), they look exactly like arrays when using print_r() or var_dump() but isset() or array_key_exists() doesn't work. Then testing for keys, these functions always return false. Test script: --------------- check = new \stdClass(); $check->{"12"} = 37; $check2 = (array) $check; Expected result: ---------------- isset($check2[12]); -> true isset($check2["12"]); -> true Actual result: -------------- isset($check2[12]); -> false isset($check2["12"]); -> false