Jump to content

Archived

This topic is now archived and is closed to further replies.

matthew61773

PHP code help

Recommended Posts

Hi
I am doing a question in college and need some simple code in PHP.

I have to Write a PHP script that outputs your name to the screen 5 times, each time the font size increasing by 2.

Any ideas?

thanks :)

Share this post


Link to post
Share on other sites
There's a million ways to do this but....

[code=php:0]
$myName = "Phil P";
$fs = "10";

print "<ul>";
for ($i = 0; $i <= 4; $i++) {
print "<li style='font-size:".$fs."px'>".$myName."</li>";
$fs = $fs+2;
}
print "</ul>";
[/code]

Share this post


Link to post
Share on other sites
[code]<?php
$name="matthew61773";
$font=10;
$i=0;
while($i<5){
echo('<font size="'.$font+($i*2).'">'.$name.'</font><br>');
$i++;
}
?>[/code]

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.