3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SecureData { private $priv="my-private-value"; protected $prot="my-protected-value"; } function expose($obj, $attr_name) { $a = (array)$obj; $r = new ReflectionProperty($obj, $attr_name); if ($r->isPrivate()) return $a["\0".get_class($obj)."\0".$attr_name]; elseif ($r->isProtected()) return $a["\0*\0".$attr_name]; else return $obj->$attr_name; } $c = new SecureData; echo expose($c, 'priv'); # => my-private-value echo expose($c, 'prot'); # => my-protected-value
Output for git.master, git.master_jit, rfc.property-hooks
my-private-valuemy-protected-value

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