Jump to content

ComputerColumbus

Members
  • Posts

    16
  • Joined

  • Last visited

ComputerColumbus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm trying my best, especially since I'm learning on CodeAcademy! Unfortunately, their idea of learning is to push you into new topics. This excercise was slightly ahead of my knowledge. I'm also reading Paul Hudson's PHP ebook. It's steadier and goes more into detail. However, it is amazing how much I've been learning on this forum!
  2. Okay people, I got it. I commented out the //echo ($randomPosition) Thank you so much for your help! ComputerColumbus
  3. I'm really not sure what to change. Maybe echo $randomPosition? But that expression should echo one letter between paramaters 0 and 5...
  4. Okay, so it finally printed a letter. Yay! But it also prints a random number...The lesson requires me to print a letter only.
  5. I need a simpler code. I am a beginner and I'm trying to print a random letter of my name for the first time. This should work, right? $myName = "Alison"; $randomPosition = rand(0, 5); substr($myname, $randomPosition, 1) echo $randomPosition;
  6. This is what I have now but it still doesn't work...It prints Random letter from Alison: 'Alison'. $myName = "Alison"; $randomPosition = rand(0, 5); echo "Random letter from $myName: 'Alison'";
  7. Thanks as well, Barand! I'm having trouble printing a random (or letter character) from my name with this source code: $myname = "Alison"; $partial = substr($myname, 0, 5); print rand(0, 5);
  8. Sorry, "Alison" has only 5 letters. I meant to ask, shouldn't letter "n" be at position 5? But why does it start from right to left at position -1? Why doesn't it start at position 0?
  9. CodeAcademy says that the letter "n" should be at position -1
  10. Hi there, I'm learning how to code on CodeAcademy. In one of the lessons it says that substr() treats character in a string as a zero-indexed array, and that the first letter of my name "Alison" is at position zero and the last letter at position -1. Why is my last letter name at position -1? Shouldn't it be at position 6? I'm trying to print a random letter from my name with this code. So far I wasn't able to. $myname = "Alison"; $partial = substr($myname, 0, 3); print rand(a, n); Any advice would be appreciated... Regards, ComputerColumbus
  11. Welcome Veriax, I'm new too and so far I've enjoyed learning on this site! All the Best, ComputerColumbus
  12. It worked, thank you everyone! Computer Columbus,
  13. 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Your own do-while</title> 5 <link type='text/css' rel='stylesheet' href='style.css'/> 6 </head> 7 <body> 8 //write your do-while loop below 9 <?p 10 $red = "exciting"; 11 do { 12 echo "<p>It's $red to be red.</p>"; 13 $red = false; 14 } while ($red = "exciting"); 15 ?> 16 </body>0 17 </html> This is the error message that it gives me: Parse error: syntax error, unexpected T_VARIABLE on line 10
×
×
  • 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.