<?php $string = " Name: John Doe Address: 123 Main St City: Chicago State: IL Zip: 60021 Name: Jane Smith Address: 123 State Ave City: Boston State: MA Zip: 02501 Name: John Doe Address: 123 Main St City: Chicago State: IL Zip: 60021"; preg_match_all('!(Name.*|Address.*|City.*|State.*|Zip.*)!', $string, $results); $records = array_chunk($results[0], 5); var_dump($records);
You have javascript disabled. You will not be able to edit any code.