PHP比较HTML字符数组解决方案 [英] PHP compare HTML characters array Solution

查看:54
本文介绍了PHP比较HTML字符数组解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在$arrNew[4]中得到了一个值,我想在$arrNew上运行一个foreach循环,然后 检查值是否等于$arrNew[4].

I got a value in $arrNew[4], I want to run a foreach loop on $arrNew and check if a value is equal to $arrNew[4].

我想将$arrNew$arrNew[4]中的值进行比较.

I want to compare $arrNew with the value in $arrNew[4].

问题是,大多数时候都不存在该值,所以我 希望将其作为字符串,这样我就可以在其他部件上使用它. 但是,如果我echo $arrNew[4]退出,我会得到"vrij &nbsp &nbsp "

The problem is, that value isn't there most of the times, so i want it as a string so i can use it on other parts. But if I echo $arrNew[4] out I get "vrij &nbsp &nbsp "

它与$arrNew[4]中的不一样,因为我不能执行$forNew == "vrij &nbsp &nbsp " 但我可以做$forNew == $arrNew[4]

It isn't the same as in $arrNew[4] because I can't do $forNew == "vrij &nbsp &nbsp " but I can do $forNew == $arrNew[4]

我应该怎么做?

感谢您的帮助:)

foreach ($arrNew as $forNew)   
{           
   $forCount = $forCount + 1 ;
   if($forNew == $arrNew[4])
   {
      echo "Vrij: ".$arrOld[$forCount] ;
   }
}

推荐答案

您看看 http://www.php.net/manual/zh/function.array-diff.php

这篇关于PHP比较HTML字符数组解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆