Hello. I have an array with Russian keys and values.

$propertiesAds['аренда'] выводит string(94) "Посуточно" 

I am writing such a condition

 if($propertiesAds['аренда']=="Посуточно") 

but it does not work. All spaces are removed. Tell me why? UTF-8

  • but where to dig then = ( - Sarkis Allahverdian
  • here most likely 'by the day' in English o it is written: D - Naumov
  • 2
    "By the day" - how little are the letters to type 94 bytes ("string (94)"), are you sure that it returns exactly these letters? - Bookin
  • one
    trim($propertiesAds['аренда'])=="Посуточно" ? - Bookin

2 answers 2

The line contained more characters than expected.

The strlen function can specify how many bytes are in a string. (as well as var_dump).

It was enough to remove extra whitespace:

trim($propertiesAds['аренда'])=="Посуточно"

    Use binary-safe strcasecmp to compare strings.