3v4l.org

run code in 300+ PHP versions simultaneously
<?php $all_states = [ "Ontario" => 0, "Manitoba" => 0, "New Brunswick" => 0, "Yukon" => 0, "Saskatchewan" => 0, "Prince Edward Island" => 0, "Alberta" => 0, "Quebec" => 0, "Nova Scotia" => 0, "British Columbia" => 0, "Nunavut" => 0, "Newfoundland and Labrador" => 0, "Northwest Territories" => 0 ]; $country_states = [ "Alberta" => 17, "Cairo" => 1, "Calgary" => 1, "ddd" => 4, "gfdxf" => 1, "New Cairo" => 1, "Ontario" => 1, "secret" => 30 ]; var_export(array_replace($all_states, $country_states));
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
array ( 'Ontario' => 1, 'Manitoba' => 0, 'New Brunswick' => 0, 'Yukon' => 0, 'Saskatchewan' => 0, 'Prince Edward Island' => 0, 'Alberta' => 17, 'Quebec' => 0, 'Nova Scotia' => 0, 'British Columbia' => 0, 'Nunavut' => 0, 'Newfoundland and Labrador' => 0, 'Northwest Territories' => 0, 'Cairo' => 1, 'Calgary' => 1, 'ddd' => 4, 'gfdxf' => 1, 'New Cairo' => 1, 'secret' => 30, )

preferences:
148.48 ms | 408 KiB | 5 Q