I am a newcomer in Php. Given below is my array
Array
(
[0] => {"tranc":["2"],"report":["2"],"company":["2"],"facilities":["2"],"area":["1"],"zone":["2"]}
[1] => {"tranc":["2"],"report":["2"],"company":["1"],"facilities":["1"],"area":["1"],"zone":["2"]}
)
I need to compare Arry[0] and Array[1] and get field of value "1" and store in an array.something this
{"tranc":["2"],"report":["2"],"company":["1"],"facilities":["1"],"area":["1"],"zone":["2"]}
$array = array(
'{"tranc":["2"],"report":["2"],"company":["2"],"facilities":["2"],"area":["1"],"zone":["2"]}',
'{"tranc":["2"],"report":["2"],"company":["1"],"facilities":["1"],"area":["1"],"zone":["2"]}',
);
var_dump($array[1]); // will have the row you want i.e row with key = 1
echo '<br>';
echo '<br>';
var_dump(json_decode($array[1])); // will have the object decoded from the json string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.