+ 5
I have this question in PHP challenge, I don't know how they get .
What is the output of this code? $s="Hi I love PHP."; $f=$s[strlen($s)-1]; echo $f;
3 Respuestas
+ 13
output :
P
+ 11
The output is the last charater of the string: '.'
strlen gives you the length of the string = 14 characters
Because first character of the string is in position 0, last character is in position strlen($s)-1
$s[13] is character '.'
+ 1
ami jainena