I have a problem with my script over here. I have got this array:
Array
(
[KUNDENNUMMER] =>
[BEZ] =>
[DATUM] => 2014-10-10
[VON] => 11:10:36
[BIS] => 11:48:11
[TAETIGKEIT] => Berufschule
[BEZ_01] =>
[DAUER] => 0001-01-01 00:37:00
[STUNDEN] => 0.61
[VERRECHENBAR] => F
[BEMERKUNG] => 0x000c5cf2000000ba
[USER_BEZ] => Armani, Kia
[TZ_BEZ] =>
[TT_VERRECHENBAR] => F
[TT_ID] => 80
)
I want to echo "Cake" when $row (the array) [TAETIGKEIT] == Berufschule using this code
if(strpos($row['TAETIGKEIT'], 'Berufschule') === true) echo "Cake";
But the echo never gets called. I also tried to compare directly
if($row['TAETIGKEIT'] == 'Berufschule') echo "Cake";
but it did not work either. When I do
print_r($row['TAETIGKEIT'];
it prints
Berufschule
What am I doing wrong?
var_dump($row['TAETIGKEIT'], urlencode($row['TAETIGKEIT']));output?if(strpos(trim($row['TAETIGKEIT']), 'Berufschule') !== false) echo "Cake";var_dumpyou would have seen spaces in the string if any, regardlessstrposwould still have found the string so it doesn't really make sense that usingtrimworked as the latter parameter is what it would search for.