nested for loop

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: nested for loop

Post by seandisanti » Wed Nov 07, 2012 3:19 pm

you could just do it this way; ( i hardcoded 4's instead of recreating post values, so just replace them with your values)

Code: Select all

<?php 

	for ($q=1;$q<=4;$q++) {
		echo 'Q'.$q.'<br />';
		for ($c=1;$c<=4;$c++){
			echo 'C'.$c.'<br />';
		}
	}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests