This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Functions, Part I Forum

View Course » View Exercise

949 points
4ba467a2e7bfcb6707d37f6c931878d5?s=140&d=retro
Submitted by
Kiana Ward
almost 3 years ago

Did you print your name in uppercase?

So I think my code is right but it comes back saying that i haven't printed in uppercase although it is showing. My code is below, please help.

<html>

<p>
  <?php
// Get a partial string from within your own name
// and print it to the screen!
$myname = "leigh";
$partial = substr($myname, 0, 3);
print $partial;
?>


<?php
// Make your name upper case and print it to the screen:
$myname = "leigh";
$upper = strtoupper ($myname);
print $upper;
?>


<?php
// Make your name lower case and print it to the screen:
$myname = "leigh";
$lower = strtolower ($myname);
print $lower;
?>
  </p>
  </body>
</html>

1 vote

permalink

i have a suspicion...
what happens, if you rename your variable to $myName (with capital N).

maybe the checking cannot recognize/ accept the var name as is.

btw: no need to declare/ set $myName three times. do it in the first PHP-block. afaik the variable lives on. its scope is not limited to within one <?php ... ?> segment

565 points
979959283057c57a3f6d3e87c633b2b4?s=140&d=retro
Submitted by
jimhatesaccounts
almost 3 years ago