I have this feature setup for loading a number of songs, however I would like to change the code so it only allows user to upload 4 songs then, see, you have reached the limit.

How Would you suggest adding code fi to this php code below?

Code:
<?php

	
	$k = 4;
	//$n=5;
	for ($i=0, $n=count( $this->songs ); $i < $n; $i++)
	//for ($i=0, $n=count( $this->songs ); $i < $n; $i++)
	{
		$song = &$this->songs[$i];
		$checked 	= JHTML::_('grid.id',   $i, $song->id );
		$link_edit = JRoute::_( 'index.php?song&userid='.$this->album->user_id.'&layout=form&id=' . $song->id .'&from=album');
	
		?>
		<tr class="<?php echo "row$k"; ?>">
		
			<td>
				<?php echo $checked; ?>
			</td>
            <td>
        			<input class="text_area" type="text" name="disc_num_<?php echo $song->id;?>" id="disc_num_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->disc_num;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="num_<?php echo $song->id;?>" id="num_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->num;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="position_<?php echo $song->id;?>" id="position_<?php echo $song->id;?>" size="3" maxlength="1" value="<?php echo $song->position;?>" />
			</td>
            <td>
				<input class="text_area" type="text" name="song_<?php echo $song->id;?>" id="song_<?php echo $song->id;?>" size="20" maxlength="255" value="<?php echo $song->name;?>" />
			</td>

            <td>
				<a href="<? echo $link_edit; ?>"><img src="components/com_muscol/assets/images/page_white_edit.png" title="<? echo JText::_( 'Edit this song' ); ?>" alt="<? echo JText::_( 'Edit this song' ); ?>" /></a>
			</td>
        

		</tr>
		<?php
		$k = 1 - $k;
		

	}
	?>