Jump to content

Loose_Goose

New Members
  • Posts

    3
  • Joined

  • Last visited

Loose_Goose's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Please be patient with me as I am only a beginner. I am trying to learn this on my own using online tutorials. I have written the following code; <?php $counter=30; while ($counter>-1) { echo $counter; $counter=$counter+-1; if ($counter==0){ while ($counter<30) { echo $counter++; $counter=$counter++; } } } ?> It runs continuously. I want it to count down to zero, up to 30 again, and then stop. I also want to know how I can get each number to appear on a separate line instead of all the numbers appearing on the same line.
  2. I'm a beginning coder, and I put this together. Here it is; <?php $pizzaS['slice1']='meat'; $pizzaS["slice2"]='meat'; $pizzaS['slice3']='meat'; $pizzaS['slice4']='veg'; $pizzaS['slice5']='veg'; $pizzaS['slice6']='veg'; $pizzaS['slice7']='veg'; $pizzaS['slice8']='meat'; foreach($pizzaS as $key=>$value){ if($value==meat){ echo "I'll take that slice<br/>";} else{ echo "You can have that one<br/>";} ?> I'm getting the output I want but every other line says something about an 'assumed variable.' I can't figure out what I'm doing wrong here. I'd appreciate some help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.