How can I make a php counter that updates on page refresh?

  • Thread starter Thread starter Realest Baller
  • Start date Start date
R

Realest Baller

Guest
I have the following code:

<?php



$num = //count from 1 to 4 on refresh;

if($num == 4){
//redirect
header( 'Location: random2.php' ) ;
}
else{

//starts the random quote switch loop
switch ($num)
{
case 0:
echo "No soup for you!";
break;

case 1:
echo "Smile!";
break;

case 2:
echo "Time for tea.";
break;

case 3:
echo "Today is your lucky day.";
break;

case 4:
echo "Fead the birds.";
break;
}
}

?>

//I want the $num variable to count from 1 to 4 on each page refresh //then reset itself the 5th time and then redirect to another page.
 
Back
Top