3v4l.org

run code in 200+ php & hhvm versions
<?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;
based on KKvDC
Output for 5.6.30, hhvm-3.18.5 - 3.21.3, 7.0.30 - 7.3.1
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 Notice: Undefined index: priv in /in/1hLkj on line 31 Private: ; Exists: true; Is prop set: false; Is index set: false; Array index: false; Empty: true
Output for hhvm-3.22.0
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 Notice: Undefined index: priv in /in/1hLkj on line -1 Private: ; Exists: true; Is prop set: false; Is index set: false; Array index: false; Empty: true