foreach (range(1, 5) as $i) { foreach (range(1, $i) as $j) { echo '*'; } echo "\n"; }