- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- MyClass Object ( [variable] => 123 )
<?php
class MyClass
{
public $variable;
public function publicMethod() { print_r($this); }
public function example()
{
// this resolves to "publicMethod of MyClass"
// there is an instance of MyClass in the scope so it is used - the method is not called statically
MyClass::publicMethod();
}
}
$object = new MyClass();
$object->variable = 123;
$object->example();