I am trying to decode an array of objects that I made in javascript and sent to php however, I cant seem to decode it correctly. The array with an object looks like this:
the php code that I am using to get the information is this:
$allInformation = $_POST['information'];
//this works
$user = $allInformation[count($allInformation)-2];
$num = $allInformation = [count($allInformation)-1];
//this doesnt work
$array = var_dump(json_decode($allInformation));
The index of array 1 and 2 work just fine, however, I cant seem to decode index 0 which is the object. How may I go about this?
got it to work, the array to php which was JSON stringified was [{"user":"user","date":"03/17/2017"},"user",134997] and i did $update = json_decode($_POST['information']); and then looped it to get user and date as obejcts i.e. $update[$i]->date . thanks all