Because do
is reserved keyword in PHP.
Demo of do
as method name. (An error)
Demo without do
, successfull outputs 2
You should change method name from do
to something else since it is reserved keyword used in do-while
loop.
More Related Contents:
- Redefine Class Methods or Class
- Calling a function within a Class method?
- Use global variables in a class
- Declaration of Methods should be Compatible with Parent Methods in PHP
- Can I extend a class using more than 1 class in PHP?
- Is it possible to define a class property value dynamically in PHP?
- What is a class in PHP?
- How to initialize static variables
- What is ::class in PHP?
- PHP Fatal error: Cannot redeclare class
- mysqli_query() expects parameter 1 to be mysqli, object given
- Difference between method calls $model->relation(); and $model->relation;
- array_unique for objects?
- When to use static vs instantiated classes
- Initializing PHP class property declarations with simple expressions yields syntax error
- My Magento Extension Install Script Will Not Run
- PHP Accessing Parent Class Variable
- declare property as object?
- Can you create instance properties dynamically in PHP?
- Returning a value in constructor function of a class
- Can I use PHP reserved names for my functions and classes?
- How do I get a PHP class constructor to call its parent’s parent’s constructor?
- PHP __PHP_Incomplete_Class Object with my $_SESSION data
- What’s difference between __construct and function with same name as class has? [duplicate]
- Get all instances of a class in PHP
- implicit class variable declaration in php?
- Get all defined classes of a parent class in php
- Laravel / Intervention Image Class – class not found
- Is there a call_user_func() equivalent to create a new class instance?
- Method Chains PHP OOP