PHP Program to check prime number?

PHP program and logic to check the number is prime or not.

Please get the below PHP code that will check number is prime or not:

$n = "11411";

$len = strlen($n);

$f=0;

for($i=0,$j=$len-1;$i<$len/2;$i++, $j--)

{

 if($n[$i] != $n[$j])

    {

     $f=1;

    break;

    }

}

if($f==0)

{

echo "Prime";

}else{

echo "Not Prime";

}