3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Input { /** @var array $attributes */ private $attributes = []; /** * @param $key * @return mixed|string */ public function getAttribute($key) { return isset($this->attributes[$key]) ? $this->attributes[$key] : null; } /** * @param $key * @param $value * @return $this */ public function setAttribute($key, $value) { $this->attributes[$key] = $value; return $this; } /** * @param array $attributes * @return $this */ public function setAttributes(array $attributes) { $this->attributes = $attributes; return $this; } /** * @return array */ public function getAttributes() { return $this->attributes; } public function render() { $html = '<input '; foreach ($this->getAttributes() as $key => $val) { $html .= $key.'="'.$val.'" '; } $html .= '/>'; return $html; } } $input = new Input(); $input->setAttribute('id', 'pr_id') ->setAttribute('name', 'project_id') ->setAttribute('type', 'text'); echo $input->render();
Output for git.master, git.master_jit, rfc.property-hooks
<input id="pr_id" name="project_id" type="text" />

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:
161.93 ms | 405 KiB | 5 Q