3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $data; public function __construct() { $this->data = array( "Name" => "Fred", "Occupation" => "Flintstone Mason" ); } public function print_data() { foreach ($this->data as $k => $v) { echo "k=".$k." v=".$v."\n"; } } public function get_data() { return $this->data; } } $a = new A(); $a->print_data(); $ar = $a->get_data(); $ar['Age'] = 50; $a->print_data(); echo $ar['Age'];
based on ibFVR
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
k=Name v=Fred k=Occupation v=Flintstone Mason k=Name v=Fred k=Occupation v=Flintstone Mason 50