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

Functions, Part I Forum

View Course » View Exercise

1074 points
56c6df404a69251081000402_907100238
Submitted by
Ali Marwan
about 2 years ago

3/8 Why when using capital letter and small letters matters in (args) strings ?

<?php
// Print out the position of a letter that is in
// your own name
$ali=strpos("ali","a"); <=== the string "ali" here is small if changing to "Ali" it won't output a number...
echo $ali;

?>
</p>
<p>
<?php
// Check for a false value of a letter that is not
// in your own name and print out an error message
if(strpos("Ali","b")===false){
    print "sorry no B found in Ali";
}
?>
</p>

0 votes

permalink

Hello, Ali!
Just try to rewrite your request to strpos() .
I mean, change
$ali=strpos("ali", "a");
to:
$ali = strpos("Ali", "A");
It happenes just in cause of your name case. PHP is case sensetive, you know.

Good luck.
Alexey.

753 points
36753995f6cedf42961196abf638ec2c?s=140&d=retro
Submitted by
Alexey
about 2 years ago

2 Comments

57b37dd72ddfa37b8e00003e_477230936 Juwuralo almost 2 years ago

??

57b37dd72ddfa37b8e00003e_477230936 Juwuralo almost 2 years ago

I tried it didn't work.Why?