...

View Full Version : Help with PHP code



catgillespie
11-19-2011, 01:53 AM
I am new to php and need help getting a program started. I need to figure a php code of a table of squares: The square of 1 is 1
The square of 2 is 4
The square of 3 is 9

Could someone help me get on track?

Thanks,
Cat

Adee
11-19-2011, 01:54 AM
I am new to php and need help getting a program started. I need to figure a php code of a table of squares: The square of 1 is 1
The square of 2 is 4
The square of 3 is 9

Could someone help me get on track?

Thanks,
Cat




function sq($num)
{
return $num^2;
}


or just




for($i=0;$i<50;$i++)
{
echo "The square of $i is ". ($i^2) . "<br />";
}

catgillespie
11-19-2011, 06:44 PM
I could not get this to work....:(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum