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

Functions, Part I Forum

View Course » View Exercise

1530 points
54e362b6e39efed280002576_62031016
Submitted by
Chris
over 2 years ago

Code works but won't let me pass

Hey Guys!

Did I made a mistake here?

Btw its in
Functions, Part I
String Functions I

<?php
print substr("Chris", 0, 2);
?>


<?php
// Make your name upper case and print it to the screen:
print strtolower("Chris");
?>


<?php
// Make your name lower case and print it to the screen:
print strtoupper("chris");
?>


1 vote

permalink

Had the same problem. But found the way to pass.
Try to replace
print strtolower("Chris");
and
print strtoupper("chris");

Here is working example:
<?php
// Get a partial string from within your own name
// and print it to the screen!
$myname = "Martin";
$substring = substr($myname, 1, 3);
print $substring;
?>


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


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

755 points
666d059e78a27a59c4b8b381bee77807?s=140&d=retro
Submitted by
Xaas
over 2 years ago

5 Comments

54e362b6e39efed280002576_62031016 Chris over 2 years ago

I used the same solution right after posting my question^^'
Just wanted to be sure if this is a validation process error and this code would work in another environment
But thanks mate for your help!!!
I really appreciate this community!!

666d059e78a27a59c4b8b381bee77807?s=140&d=retro Xaas over 2 years ago

Me too, great place to start coding.

52f361d480ff3318c3001803_371160816 gjeh over 2 years ago

Im having the same issues, but replacing ''Martin'' with ''martin'' didn't work for me :/ it keeps giving an error on my uppercase, while it succesfully works in the top-right window.

54e362b6e39efed280002576_62031016 Chris over 2 years ago

You should post your full code, so we may find the problem together (y)

52f361d480ff3318c3001803_371160816 gjeh over 2 years ago

thanks, but i tried using variables to set $name = etc. to fix the issue.


0 votes

permalink

i figured that PHP is very Buggy and about half the time i have been in here is if you literally go and copy your code and delete it and then paste your code back in it works i dont know why it does this but try that and see if it works hope this helps

1051 points
5514083286f552209c001897_325895797
Submitted by
DarkSoulsLover54
over 2 years ago