我想用PHP找到两行之间的区别[关闭]

我想用PHP找到两行之间的区别[关闭]

问题描述:

I have two rows fetched from database... The table is something like

id | values
------------
1  | speaker
2  | modem
3  | pendrive

and another table is something like

id | values
------------
1  | speaker
2  | pendrive

I want to see like

no.| values
------------
1  | modem

我从数据库中获取了两行...该表类似于 p> id | values ------------ 1 | 发言者 2 | modem 3 | pendrive code> pre>

另一个表类似于 p>

  id |  values 
 ------------ 
1 | 发言者
2 |  pendrive 
  code>  pre> 
 
 

我希望看到像 p>

  no。  values 
 ------------ 
1 |  modem 
  code>  pre> 
  div>

You can use php array_diff, it will give you exactly what you want:
This is how it works:

$newArray= array_diff($array1, $array2);

Here is a working DEMO