2. String Functions I


#1

I got "Oops, try again. Did you remember to print your substring?" for this:

<?php
$name="

Patricia

";
$partial=substr($name,0,8);
print $partial;

$uppercase = strtoupper($partial);
print $uppercase;

$lowercase = strtolower($uppercase);
print $lowercase;
?>

But this code works good and print all of three types (substring, uppercase anf lowercase). What's wrong?..

(N.B. Editor hide tags < p > and < /p > in $name)


#2

It looks like there are 3 different php sections:


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



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



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

    ?>
  </p>
</html>

#3

Maybe try

$partial=substr($name,0,7);

there are only 8 positions identified in "Patricia"


#4

Oh, thanks, you right - there are only 8 positions in "Patricia". But correction of this doesn't help... (


#5

Now i have some trouble. Nothind happens. Somebody, help us, please.

$name = "lew";
$part = substr($name, 0 , 1);
echo $part; 
$uppercase = strtoupper($name);
echo $uppercase;
$lowercase = strtolower($uppercase);
echo $lowercase;

#6



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



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



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