<?php trait HasStatic { private static $x; public static function setX($x) { HasStatic::$x = $x; } public function useX() { return HasStatic::$x; } } class UsesStatic { use HasStatic; } HasStatic::setX(123); var_dump((new UsesStatic())->useX());
You have javascript disabled. You will not be able to edit any code.