3v4l.org

run code in 300+ PHP versions simultaneously
<?php $address = 'One Infinite Loop, Cupertino 95014'; $cityZipCodeRegex = '/^[^,]+,\s*(.+?)\s*(\d{5})$/'; preg_match($cityZipCodeRegex, $address, $matches); [, $city, $zipCode] = $matches; var_dump($matches); //saveCityZipCode($city, $zipCode);

preferences:
30.63 ms | 402 KiB | 5 Q