user3018350
user3018350

Reputation:

PHP stristr() does not work

I have to import a lot of data from one database to another, but I am having some issues that I can not figure out.

Part of the job is to parse the City column against an array of cities and find a match if one exists. I tried stristr() function, but sometimes this does not work.

For example this is working

if(stristr('Murter / ŠIBENIK', 'Šibenik'))

but this combination does not work

if(stristr('OMIŠ', 'Omiš'))

Any ideas?

Upvotes: 1

Views: 1511

Answers (3)

AndiPower
AndiPower

Reputation: 853

<?php

  if(mb_stristr("OMIš", "Omiš") === FALSE) {
    echo 'Not Found';
  }else{
    echo 'Found';
  }
?>

works

Upvotes: 0

Christian Gollhardt
Christian Gollhardt

Reputation: 17004

Try mb_stristr

http://php.net/manual/de/function.mb-stristr.php

The other function can't work with utf-8 symbols

Upvotes: 3

knittl
knittl

Reputation: 265201

Use a function that can actually work with multibyte strings, such as mb_stristr.

Upvotes: 1

Related Questions