Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php call non static method from static method

class Foo {

    private $foo;
    private $bar;

    public function __construct($foo, $bar)
    {
        $this->foo = $foo;
        $this->bar = $bar;
    }

    public function fun1()
    {
        return $this->foo . ' - ' . $this->bar;
    }

    public static function fun2($foo, $bar)
    {
        return (new self($foo, $bar))->fun1();
    }
}

echo Foo::fun2('foo', 'bar');
Comment

PREVIOUS NEXT
Code Example
Php :: wp-config.php 
Php :: laravel collection intersect 
Php :: laravel save file or picture directory 
Php :: Laravel permission to Vuejs 
Php :: add slashes to string 
Php :: laravel seeder with relationships 
Php :: -regular_price 
Php :: catch warning php 
Php :: laravel migration bigint length 
Php :: laravel looping checking if last record has reached 
Php :: joomla print query 
Php :: append single qoute arounf variable in php string 
Php :: theme mod disalow wp 
Php :: php remove non printable characters 
Php :: rodar migration laravel 
Php :: laravel FacadesDB update 
Php :: PHP is not configured to connect to MySQL 
Php :: array random php 
Php :: php compress csv file 
Php :: php pass 2 date value to javascript 
Php :: laravel OrderBy on Eloquent whereHas relationship 
Php :: phpspreadsheet select sheet 
Php :: "IlluminateDatabaseEloquentMassAssignmentException" 
Php :: PHP sprintf — Return a formatted string 
Php :: How to check if a session is expired or never was set in php 
Php :: php function return multiple values 
Php :: redirect to intent url after login laravel 
Php :: get HTML select value to PHP 
Php :: Allowed memory size of 33554432 bytes exhausted (tried to allocate 8192 bytes) 
Php :: laravel log error 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =