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

Functions, Part I Forum

View Course » View Exercise

580 points
7e2de1841b770ba0b33e46c04018336b?s=140&d=retro
Submitted by
Mckenna Adkins
about 2 years ago

Why won't this work?

I've looked and looked at my code and I have no idea what is wrong with it. If anyone has any ideas, they would be GREATLY accepted.

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

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

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

0 votes

permalink

Your code looks just fine... reload the page and try it again

409 points
2bc224381e7fe7ec21ae8b23444a084e?s=140&d=retro
Submitted by
tuchix
about 2 years ago

1 Comment

7e2de1841b770ba0b33e46c04018336b?s=140&d=retro Mckenna Adkins about 2 years ago

I tried that, it did not work.


0 votes

permalink

I delete the first and last two lines, then it works! ;)

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

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


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

487 points
D9f7a99b56012983b85681470ad190e5?s=140&d=retro
Submitted by
Jessie P.
about 2 years ago


0 votes

permalink

This took FOREVER. Here's the way to get it to work.
answer the first part of code, hit submit, it will tell ask you if you used the strtoupper. Fill out that part of the code, then it will ask you if you used the strtolower. Fill that out and the code will pass.
Final code looked like this:

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

?>


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


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

212 points
6e2105a5fcfb39bb9dc4360add3cb723?s=140&d=retro
Submitted by
sktf
almost 2 years ago