<?php abstract class Category { public $foo = [1, 2, 3]; public function getCategories($type) { return $this->foo; } } class ChildCategory extends Category { } // This works fine $categories = (new ChildCategory())->getCategories('xxx'); var_dump($categories); // Fatal error: Uncaught Error: Using $this when not in object context $categories = Category::getCategories('xxx'); var_dump($categories);
You have javascript disabled. You will not be able to edit any code.