I have a directory "Dir1" that contains n directories which were named with non latin characters
I got the names of these directories by scandir
$allDirs = scandir( ARCHIVE_DIR) ;
foreach( $allDirs as $dir){.....}
and I want to comapre each dir name with strings I have but the comapre return false I tried
if( $dir == "أخبار" )
AND
if( utf8_encode ( $dir ) === utf8_encode( "أخبار" ) )
AND
strcmp ( $dir , "أخبار" )
AND
mb_strpos( $dir , "أخبار" )
When I tried
mb_detect_encoding($dir)
mb_detect_encoding("أخبار")
both of them returned utf-8 I'm not sure what is the issue here when I tried to print them to log via
file_put_contents( "n.log" ,$dir."--"."أخبار" ."
", FILE_APPEND ) ;
it print identical strings !!!! but the compare always fail how to fix that ?