Multiplication table code

Views: 409 Last modified: August 03rd, 2011 Comments: 0

How to create a multiplication table in PHP ? Well… Look at this!

$start = 15;
$end = 30;

echo '<table>';
	echo '<tr><th></th>';
		for ($x = $start; $x <= $end; $x++)
			echo '<th>'.$x.'</th>';
	echo '</tr>';
		for ($y = $start; $y <= $end; $y++):
			echo '<tr><th>'.$y.'</th>';
				for ($z = $start; $z <= $end; $z++):
					echo '<td>'.($y * $z).'</td>';
				endfor;
			echo '</tr>';
		endfor;
echo '</table>';
VN:F [1.9.13_1145]
Rating: 5.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
Multiplication table code, 5.0 out of 10 based on 1 rating
    Bluehost

    Mail this!

    To: From:Sum {1+8} =  
    Anything to add ?

        You must be logged in to post a comment.