0

What is means of speak()

I was get stuck in this silly method called as speak() <?php class Person { public $age; function speak() { echo "Hi!"; } } $p1 = new Person(); $p1->age = 23; echo $p1->age; $p1->speak(); ?>

9th Oct 2020, 12:41 PM
Riyaz Khan
Riyaz Khan - avatar
3 Respuestas
+ 1
No body know that. We need to see the code. Not only the Name of a method. It could be or do everything.
9th Oct 2020, 12:56 PM
Coding Cat
Coding Cat - avatar
+ 1
Show the code
9th Oct 2020, 1:05 PM
Shadoff
Shadoff - avatar
+ 1
Riyaz Khan , this is class method! when you call speak() method, it prints (echoes) "Hi!" as coded(described) the class Person
9th Oct 2020, 5:26 PM
Shadoff
Shadoff - avatar