|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-10-24 09:21 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2017-10-24 09:21 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Description: ------------ When you convert array from stdClass you will get array with many stdClasses. Isset on index of array element will not work correctly if you try it. Test script: --------------- $id = '11400'; $json = '{"11400":{"test":"1","test":"2","xyz":"abc"}}'; // yes, I know second parametr, but it should work too $decodedJson = (array)json_decode($json); if (isset($decodedJson[$id])) { echo 'exists!'; } else { echo 'not exists!'; }