Nested loop
Posted: Fri Apr 04, 2014 10:25 am
Hi all,
I'm trying to output a nested loop that shows numbers from number 1 being a small font to 12345 being the biggest font but I can't seem to get it working correctly,see attached code.
1 = font 10
12 = font 12
123 = font 14
1234 = font 16
12345 = font 18
Regards,
Jack
I'm trying to output a nested loop that shows numbers from number 1 being a small font to 12345 being the biggest font but I can't seem to get it working correctly,see attached code.
1 = font 10
12 = font 12
123 = font 14
1234 = font 16
12345 = font 18
Code: Select all
<?php
$sz=array("10px","12px","14px","16px","18px");
for ($i=1;$i<6;$i++) { ?>
<span style="font-size:<?= $sz[$i-1] ?>"><?= $i ?></span><br />
<?php
}
?>Regards,
Jack