I'm developing a page that takes the info of a json, print a form with the json's values, the user can change it and now I'm trying to upload this data to override the original json with the new data. At this point, I have two arrays, one with the "keys" of the json, and another with the new data that must contain. I can't build the json in the correct way. The problem is to match the two propierties (key and data) to make an array for json_decode after.
I have:
$arrayClave with the keys of the json.
and $guardar with the new data.
I have to build a new json with the keys plus the data, like this:
{"ID":"12450","MARCA":"Roly" .... }
I've tried to build the array like array($arrayClave[1] => $guardar[1]);
but I need to build it for every number of inputs, that change in different cases, so I need to use a loop, but it's not possible to do something like:
for($i=0; $i<99; $i++){
$var = $arrayClave[$i] => $guardar[$i],;
}
$result = array($var);
I know this is not correct, but I don't know the way to do it. If someone can help me I'll be gratefull, I hope I've explained myself in the best way :) Thanks in advance!