![]() If the dox said JUST arrays and objects, then that would be fine too. Admittedly, an array with int/bool/null in all work fine as does a multi-dimensional array. $m_var = json_decode(json_decode($m_original_var)) Json_decode says it "takes a JSON encoded string and converts it into a PHP variable". I'm reading the PHP doc and json_encode says it can encode _ANY_ type except resource. RQuadling at GMail dot com I'm not sure I follow. $m_JS_Decoded_Array = json_decode($s_JS_Encoded, True) Įcho "\n=\nEncoding $s_Type : " Įcho (serialize($m_Data) = serialize($m_JS_Decoded_Array)) ? "\nMatches\n" : "\n**** DOES NOT MATCH ****\n" Įncoding SimpleString : string(16) "This is a string"Įncoded : string(18) ""This is a string""Įncoded : string(31) "" And as this has been fixed in CVS, then I suspect this is now a documentation issue. ![]() Returns a JSON encoded string on success."Īmendment after trying to submit bug : I see that bug#38440 relates to this. "Returns a string containing the JSON representation of value. I can allow for the integer to not match as there is no type info as far as I can tell. Though I think the NULL working is just a fluke. This seems to work fine for arrays and null (not tested with objects), but doesn't work at all with strings, integers or booleans. I might be widly wrong but I would have thought that json_decode would quite happily reverse a json_encode.
0 Comments
Leave a Reply. |