<?php
function isArabic($str) {
    // Match Arabic Unicode character range
    return preg_match('/\p{Arabic}/u', $str);
}

function isEnglish($str) {
    // Match English alphabet character range
    return preg_match('/^[a-zA-Z]+$/', $str);
}
$string = "Saddam nagi abdu";
$strin1 = str_replace(' ', '', $string);
if(isArabic($strin1)){
   echo "arabic";
      }elseif(isEnglish($strin1)){
    echo "en";
      }else{
        echo "ff";
      } 
?>