This forum is now read-only. Please use our new forums! Go to forums
6/8 Getting an error even if the code is working
I don’t see anything wrong with my code,it prints “MAXIMUM” exactly as it is in the instructions:
<?php
class Person {
}
class Ninja extends Person {
// Add your code here...
const stealth= "MAXIMUM";
}
// ...and here!
echo (Ninja::stealth);
?>
But I always get the same error
Oops, try again. Did you create a constant called stealth? (Remember, you don’t use $ with constant names!)
Answer 55f0cc1ed3292fdec800013c
1 vote
Well… this worked for me… was having the same problem…
<?php
class Person {
const stealth = "MAXIMUM";
}
class Ninja extends Person {
// Add your code here...
public function __construct() {
}
}
// ...and here!
echo Ninja::stealth;
?>
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