BY Best Interview Question ON 26 Jan 2019

Example

function IsPrime($n) {

for($x=2; $x<$n; $x++)

{

if($n %$x ==0) {

return 0;

}

}

return 1;

}

$a = IsPrime(3);

if ($a==0)

    echo 'Its not Prime Number.....'."\n";

else

    echo 'It is Prime Number..'."\n";