Search code examples
phparabic

php strstr not detecting substring in a arabic string


Can anyone please tell me ,How to make string matching function work with Arabic keywords? The Following keywords are detected as Unmatched in php. Though these are matching in normal browser searching.

    if (strstr('الهيئة العامة للقوى العاملة', 'قوى العامله') != false) {
       echo'in';
          } else {
          echo'out';
           }die;

Result comes as 'out'.

Thanks


Solution

  • Try this .. I have PHP Version 5.6.23

    <?php 
    $string = 'الهيئة العامة للقوى العاملة';
    $find_me = 'قوى العاملة';
    if (strstr($string, $find_me) != false) {
           echo'in';
              } else {
              echo'out';
               }die;
    
    ?>
    

    You can see output here https://eval.in/764085