<?php
// Print Rhombus Star Pattern in PHP
// It's the size of the pattern
$x = 10;
if ($x > 0) {
// calling function to print the pattern
rhombusPattern($x);
}
// It's the driver function to print the rhombus pattern
function rhombusPattern($x = 0) {
if (! $x)
return FALSE;
for ($i = 1; $i <= $x; $i++) {
// print the spaces
for ($j = $i; $j < $x; $j++)
echo " ";
// print the stars
for ($j = 1; $j <= $x; $j++)
echo "*";
echo "\n";
}
}
?>