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

Functions, Part I Forum

View Course » View Exercise

691 points
552e82d7e39efefb44000118_258739625
Submitted by
Olly
over 2 years ago

Where am I going wrong? *print your name in UPPERCASE* (Php - Functions, Part 1 - 2/8)

Almost positive I hadn't made any simple mistakes, however it doesn't count as a pass and displays

"Oops, try again. Did you remember to print your name in UPPERCASE?"

Can anyone figure out what I'm not doing right?

Here's my code:

<html>
 <body>
  <p>

  <?php
$myName = "Olly";
$partial = substr($myName, 0, 4);
print $partial;
?>

<?php
$upper = strtoupper($myName);
print $upper;
?>

<?php
$lower = strtolower($myName);
print $lower;
?>

   </p>
  </body>
 </html>

1 vote

permalink

I kept getting an error on that one as well. It took ages before it accepted my code and I didn't know what the error was.

I reset the code and the below code and format worked for me.

It could just be the way the computer assessment looks at the code and where you're written it. I hope the below code helps you.

I had html tags but didn't have any body tags in my code, I had the p tags for each set of code and I also left the comments in that were there originally. They are the only differences I can see.

This is the code I submitted and it finally worked for me:

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

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

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

467 points
6de3d2320a99a8796c71406b9a1dc8bd?s=140&d=retro
Submitted by
Robert Wise
over 2 years ago

2 Comments

552e82d7e39efefb44000118_258739625 Olly over 2 years ago

Thank-you, this worked!

53fd28db9c4e9df642000123_417645317 Psychoborg over 2 years ago

When I tried this, it said "Did you remember to print your name in lowercase?"