PHP value doesn't equal to what it echoes
I got a value in $array[1]
and I want to know what it is, so I
can compare it in other parts of my code.
So I echo out $array[1] and I get "vrij     " or "vrij "
$value = $array[1];
echo $value ; // outputs "vrij "
if($value = $array[1]){
echo "TRUE 1";
}
if($value = "vrij "){
echo "TRUE 2";
}
The开发者_Python百科 problem is, it only echo's TRUE 1. I copy pasted the echo exactly but it doesn't return TRUE 2
You're assigning the value of $array[1]
to $value
, not comparing them. Change the =
into ==
inside the if clauses.
精彩评论