[Solved] how to display a string pattern using php loops


$array = "computer";
$count = strlen($array);
for($i=0;$i<=$count;$i++)
{ 
  echo substr($array,0,$i+1)."<br>";
}

$array = "computer";
$count = strlen($array)-1;
$out="";
for($i=0;$i<=$count;$i++)
{
  $out .= $array[$i]; 
  echo $out."<br>";
}

Have a nice day 🙂

2

solved how to display a string pattern using php loops