Possible Duplicate:
How to check if an array element exists?
apologize if i am wrong,I am new to PHP, Is there any way to find out whether key exists in Json
string after decoding using json_decode
function in PHP.
$json = {"user_id":"51","password":"abc123fo"};
Brief:
$json = {"password":"abc123fo"};
$mydata = json_decode($json,true);
user_id = $mydata['user_id'];
If json string doesn't consist of user_id,it throws an exception like Undefined index user_id
,so is there any way to check whether key exists in Json string,Please help me,I am using PHP 5.3 and Codeigniter 2.1 MVC
Thanks in advance