Compilation of several PHP algorithms involves the following examples.
PHP Bubble
PHP Dichotomy
PHP Finding Prime Numbers
PHP Multiplication Table
PHP bubbling method example
Copy code
php find prime numbers – calculate the prime numbers between a and b. Code example
Copy code for($i=$a;$i <=$b;$i++)
The code is as follows:
//php find prime numbers - Calculate the prime numbers between a and b.
function sushu($a,$b)
{
if(!empty($a) && !empty($b))
{
if($b<$a) return;
$temp = array();
{
$j = intval(sqrt($i));
$flag = true;
if($i<=3)
{
$temp[$i] = $i;
}else
{
for($x=2;$x<= $j;$x++)
🎜> }
if($flag)
$temp[$i] = $i;
}
}
}
return $temp;
}
}
PHP output multiplication table - recursive code example
Copy code
The code is as follows:
Copy code
The code is as follows:
TechArticle