3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface User{ // User接口 public function getName(); public function setName($_name); } class NormalUser implements User { // 实现接口的类. private $name; public function getName(){ return $this->name; } public function setName($_name){ $this->name = $_name; } } class UserAdmin{ //操作. public static function ChangeUserName(User $_user,$_userName){ $_user->setName($_userName); } } $normalUser = new NormalUser(); UserAdmin::ChangeUserName($normalUser,"Tom");//这里传入的是 NormalUser的实例. echo $normalUser->getName(); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Tom

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:
39.81 ms | 401 KiB | 8 Q