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

Functions, Part I Forum

View Course » View Exercise

839 points
C4075fb9eac7a154de2050b88a41d85d?s=140&d=retro
Submitted by
mk_cupcake
about 2 years ago

2/8 Why doesn't it work?

Here is my code:

<?php
$myname = "jdsajkfhdks"

$partial = substr($myname, 0, 2);
echo $partial;
?>

<?php
$upper = strtoupper($myname);
echo $upper;

?>

<?php
$lower = strtolower($myname);

echo $lower;
?>

Please tell me if you see any errors. Thanks!


2 votes

permalink

Also, you need a semi colon after declaring the variable
$myname
So the code will be
<?php
$myname = "jdsajkfhdks";

$partial = substr($myname, 0, 2);
 print $partial;
 ?>
<?php
$upper = strtoupper($myname);
print $upper;

?>

<?php
$lower = strtolower($myname);


print $lower;
 ?>

84 points
58dfeefe6da941159e1d7974744b8bb8?s=140&d=retro
Submitted by
JohnDenton1
about 2 years ago


1 vote

permalink

it says print it that means write print in your code instead of echo.

1061 points
9aafefbc0880681c07d2a345dbef8b5f?s=140&d=retro
Submitted by
Sigma18
about 2 years ago