3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { private string $firstName; private string $lastName; private int $age; public function __construct(string $firstName,string $lastName,int $age) { $this->firstName=$firstName; $this->lastName=$lastName; $this->age=$age; } public function renderHtml(){ $html=""; $template="<p><b>%s:</b> %s</p>"; foreach (get_object_vars($this) as $k=>$v) { $html.=sprintf($template,ucfirst($k),$v); } return $html; } } $unaPersona=new Person("Pedro","Serrano",25); echo $unaPersona->renderHtml(); //var_dump($unaPersona); ?>
Output for git.master_jit, git.master, rfc.property-hooks
<p><b>FirstName:</b> Pedro</p><p><b>LastName:</b> Serrano</p><p><b>Age:</b> 25</p>

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