3v4l.org

run code in 300+ PHP versions simultaneously
<?php $address = "House No. 1234-ABC, Second Floor, XYZ Building, ABC Mall Road, Street Number 1234, ABC Area"; $address_length = strlen($address); if ($address_length > 80) { $parts = explode(',', $address); list($address1, $address2) = array_map(function($x) { return trim(implode(',', $x)); }, array_chunk($parts, 3)); echo $address1; echo PHP_EOL; echo $address2; }

preferences:
23.6 ms | 408 KiB | 5 Q