开发者

PHP Array special value Solution [duplicate]

This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

PHP compare HTML characters array Solution

I got a value stored in $arrNew[4], I want to check if the value currently stored in $arrNew[4] is equal to another value.

The problem is, the value in arrNew[4] isn't there most of the times, so i want it as a string so i can use it on other parts.

example $string = "text" I want "text". The same goes with $arrNew[4]

But if I echo $arrNew[4] out I get "vrij &nbsp &nbsp "

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

So how should I get the value stored in $arrNew[4] to a string, without it being changed. (probably cause of special characters?)

How should I do this ?

Any help is appreciated :)

foreach开发者_如何学JAVA ($arrNew as $forNew)   
{           
   $forCount = $forCount + 1 ;
   if($forNew == $arrNew[4])
   {
      echo "Vrij: ".$arrOld[$forCount] ;
   }
}


The problem is, the value in arrNew[4] isn't there most of the times,

You should explain why.

so i want it as a string so i can use it on other parts.

Why do you think that not having it as a string will not allow you to use it elseehere, please explain.

But if I echo $arrNew[4] out I get "vrij &nbsp &nbsp "

Echoing a variable and getting &nbsp in the browser is sure there is an important piece of information that you don't display, please show it (sounds like something related html specialchar).

It isn't the same as in $arrNew[4] because I can't do $forNew ==

"vrij &nbsp &nbsp " it doesn't equal TRUE but $forNew == $arrNew[4]

It seems that apart from php you have some work to do on expressing your self, describing and presenting a problem in an understoodable way.

So how should I get the value stored in $arrNew[4] to a string, without it being changed.

Just undo whatever you did on storage, I suspect it doesn't get a value assigned in a trvial way but insted through an html specialchar function.

Finally take serious consideration on writing good question, put your self in others position.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜