This forum is now read-only. Please use our new forums! Go to forums
banner
Close banner
Code won't work but looks ok
Here is my code;
<html>
<head>
<title></title>
</head>
<body>
<?php
function displayName() {
echo "James";
}
displayName();
?>
</body>
</html>
what i don’t understand is, why doesn’t it work? according to the sample, the format and wording is correct and the code looks fine and it prints out James but its not passing.
i keep getting this error: Oops, try again. It looks like your function doesn't echo or print anything!
Answer 54d5f42093767682280046b4
1 vote
it is not working.. same problem… i did refreshing the page but didnt work
Answer 54da803286f55269fe0001e4
1 vote
ok, figured it out. You don’t have the < p> </ p> elements in your php.
<html>
<head>
<title></title>
</head>
<body>
<p> <!-- <p> -->
<?php
$myname = "Spyros";
$length = strlen("Spyros");
echo $length;
?>
</p> <!-- </p> -->
</body>
</html>
Answer 54b9b066e39efedcac000a9f
0 votes
It should work and echo your name. Try refreshing your page.
Answer 54c49bbd9113cbde55002bb3
Answer 553913cae39efed945000086
-1 votes
function returnName() { echo “James”; } returnName();
this works
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
It doesn’t work. i keep getting the error “Oops, try again. It looks like your function doesn’t echo or print anything!”