3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class World { public $greeting; public $rand; // no value private $priv; public function __construct() { $this->greeting = 'Hello'; } } $w = new World(); $wr = (array) $w; list($greet_exists, $greet_isset_o, $greet_isset_a, $greet_a_e,$greet_empty) = [ json_encode(property_exists($w,'greeting')), json_encode(isset($w->greeting)), json_encode(isset($wr['greeting'])), json_encode(array_key_exists('greeting', $wr)), json_encode(empty($w->greeting)) ]; echo "Greeting: {$wr['greeting']}; Exists: $greet_exists; Is prop set: $greet_isset_o; Is index set: $greet_isset_a; Array index: $greet_a_e; Empty: $greet_empty".PHP_EOL; list($rand_exists,$rand_isset_o,$rand_isset_a,$rand_a_e,$rand_empty) = [ json_encode(property_exists($w,'rand')),json_encode(isset($w->rand)), json_encode(isset($wr['rand'])),json_encode(array_key_exists('rand', $wr)), json_encode(empty($w->rand)) ]; echo "Random: {$wr['rand']}; Exists: $rand_exists; Is prop set: $rand_isset_o; Is index set: $rand_isset_a; Array index: $rand_a_e; Empty: $rand_empty".PHP_EOL; list($priv_exists,$priv_isset_o,$priv_isset_a,$priv_a_e,$priv_empty) = [ json_encode(property_exists($w,'priv')),json_encode(isset($w->priv)), json_encode(isset($wr['priv'])),json_encode(array_key_exists('priv', $wr)), json_encode(empty($w->priv)) ]; echo "Private: {$wr['priv']}; Exists: $priv_exists; Is prop set: $priv_isset_o; Is index set: $priv_isset_a; Array index: $priv_a_e; Empty: $priv_empty".PHP_EOL;
Output for git.master_jit, git.master, rfc.property-hooks
Greeting: Hello; Exists: true; Is prop set: true; Is index set: true; Array index: true; Empty: false Random: ; Exists: true; Is prop set: false; Is index set: false; Array index: true; Empty: true Warning: Undefined array key "priv" in /in/1hLkj on line 31 Private: ; Exists: true; Is prop set: false; Is index set: false; Array index: false; Empty: true

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:
34.76 ms | 402 KiB | 8 Q