3v4l.org

run code in 300+ PHP versions simultaneously
<?php $area_elements = ['EC1 2AY', 'EC3 4XW']; foreach($area_elements as &$v){ $v = substr($v, 0, -4); } print_r($area_elements);
Output for 5.6.38, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.28, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
Array ( [0] => EC1 [1] => EC3 )