Php 如何比较两个JSON的值?

Php 如何比较两个JSON的值?,php,json,codeigniter,Php,Json,Codeigniter,我有两个JSON,我想比较它们的值。我怎么做 例如: volume_id=["1","2","3"]; $json_volumes_id=["2","4","5"]; 我的模型: $this->db->select('*'); $this->db->from('workers_properties'); $this->db->like("volume_id","\"$json_volumes_id\""); $result_1 = $this->db

我有两个JSON,我想比较它们的值。我怎么做

例如:

volume_id=["1","2","3"];

$json_volumes_id=["2","4","5"];
我的模型:

$this->db->select('*');
$this->db->from('workers_properties');
$this->db->like("volume_id","\"$json_volumes_id\"");
$result_1 = $this->db->get()->result();

您只需使用json_decode()函数将json转换为数组,然后就可以轻松地比较它们的值。

编写要获取卷id的sql查询是columnmy表(workers_属性):id | volume _id和我的volume _id是[“1”、“2”、“3”]转换为数组,然后使用
where _in
而不是like