3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } Fatal error: Uncaught Error: Non-static method Category::getCategories() cannot be called statically in /in/eMj68:22 Stack trace: #0 {main} thrown in /in/eMj68 on line 22
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.64 ms | 405 KiB | 5 Q