<meta charset="utf-8">

<?php

function out($fun,$num){

for($i=0;$i<=$num-1;$i++){

$fun($i,$num);

echo "<br>";

}

}

function in($i,$num){ 

for($j=1;$j<$num-$i;$j++){  

echo "&ensp;";  

}

for($k=0;$k<2*$i+1;$k++){  

echo "*";

}

out("in",6);