Use explode() on the pipe character to create array2, then use array_shift to pull the first element out of that array, which you can then parse with preg_match() to get the comma-delimited section within the square brackets, which you then explode() on the commas to populate array1.