There is a line:

Ссылка на описание и полную версию 

You need to check the variable for the presence of such a string.

 $find = "Ссылка на описание и полную версию"; if(strpos($productArr[$i]["description"],$find)){ $description = ""; } else{ $description = $productArr[$i]["description"]; } 

Here is the whole line I get:

 Ссылка на описание и полную версию :https://crispy.com.ua/ottie/first-swing-recovery-essence-ottie 

I can not understand why does not find the occurrence of this substring

    1 answer 1

    I can not understand why does not find the occurrence of this substring

    Probably because strpos () returns the position of the first occurrence of the string. If it is 0 , then in the parentheses of the if () operator it will be converted to false , and the block of the else code will be executed. Use the === operator to check the value returned by this function:

     $i = 0; $productArr[0]["description"] = "Ссылка на описание и полную версию :https://crispy.com.ua/ottie/first-swing-recovery-essence-ottie"; $find = "Ссылка на описание и полную версию"; if (strpos($productArr[$i]["description"], $find) !== false) { $description = $productArr[$i]["description"]; } else { $description = ""; } echo $description; 

    To work with multibyte encodings, use mb_strpos () .