3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ "shenzhen" => [ "宝安区", "南山区", "福田区", "罗湖区", "盐田区", "龙岗区", "光明新区", "坪山新区", "龙华新区", "大鹏新区", "其它" ], "guangzhou" => [ "白云区", "天河区", "海珠区", "番禺区", "花都区", "黄埔区", "南沙区", "越秀区", "萝岗区", "荔湾区", "增城市", "从化市", "其它" ]; $city_list = array( "shenzhen" => _("深圳"), "guangzhou" => _("广州"), "foshan" => _("佛山"), "dongguan" => _("东莞")); $newArray = array(); foreach($city_list as $carr) { $newArray[] = str_replace(key($carr),"hello", $data); } print_r($newArray);
Output for 5.4.0 - 5.4.40, 5.5.24, 5.6.7 - 5.6.8
Parse error: syntax error, unexpected ';', expecting ']' in /in/WlMDS on line 31
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/WlMDS on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/WlMDS on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WlMDS on line 2
Process exited with code 255.

preferences:
234.2 ms | 1395 KiB | 133 Q