How do I return a string that builds a new table row each time a function is called in PHP?
526
I have created a function in PHP that is supposed to "return a string that builds a new table row each time it is called" . I've tried searching for how to do this but I'm unsure. Can anyone provide assistance ? My code for the function that I built is below:
<?php
//Creating the function returnRow().
function returnRow($counter, $quantity)
{
$ticketprice = 50;
if($quantity >= 300)
{
$ticketprice = 30;
}
else if ($quantity >= 200)
{
$ticketprice = 35;
}
else if ($quantity < 200)
{
$ticketprice = 50;
}
//The return statement will go here but I do not know how to create it.
//it will return a new html table row.
}
?>
Answer
Solution:
You haven't indicated how many columns are in this table but literally just return the HTML string you want: