This is the correct way
public static function userNameAvailibility()
{
$result = self::getsomthin();
}
Use self::
instead of $this->
for static methods.
See: PHP Static Methods Tutorial for more info 🙂
More Related Contents:
- What does the variable $this mean in PHP?
- When should you make an interface/contract, and when not? [closed]
- When should I use ‘self’ over ‘$this’?
- How should a model be structured in MVC? [closed]
- How to use PDO connection in other classes?
- MVC for advanced PHP developers [closed]
- What does it mean to start a PHP function with an ampersand?
- Get PHP class property by string
- What is the point of interfaces in PHP?
- Best practice on PHP singleton classes [duplicate]
- Override method parameter with child interface as a new parameter
- PHP OOP core framework
- Multiple Inheritance in PHP
- Accessing Class Properties with Spaces
- What is the difference between self::$bar and static::$bar in PHP?
- Is it possible to create static classes in PHP (like in C#)?
- When should I declare variables in a PHP class?
- Autoload classes from different folders
- When should I use stdClass and when should I use an array in php oo code?
- Chaining Static Methods in PHP?
- Dynamically create PHP object based on string
- Nested or Inner Class in PHP
- Performance of static methods vs. functions
- How to Check for a Specific Type of Object in PHP
- PHP dynamic name for object property
- How do I access static member of a class?
- dynamic class names in php
- Method Chains PHP OOP
- Best way to handle dirty state in an ORM model
- PHP Can static:: replace self::?