Check the syntax, you notice that classes have the same syntax as functions, with the brackets. Same as with the if else statements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <!DOCTYPE html> <html> <head> <title>Reconstructing the Person Class</title> <link type='text/css' rel='stylesheet' href='style.css'/> </head> <body> <p> <?php class Person { } $teacher = new Person(); $student = new Person(); ?> </p> </body> </html> |