I have an array of strings of the format "Year-Month_ID". I'd like to split each item in two at the '_'. Then, for the items that have the same prefix (year & month), join the IDs with '_' after the prefix ("Year-Month_ID_ID..."). For example, if I have the data:
array(
'2010-December_9',
'2010-December_19',
'2011-June_4',
'2011-September_38',
'2011-November_29',
'2011-November_9'
)
I want the result to be:
array(
'2010-December_9_19',
'2011-June_4',
'2011-September_38',
'2011-November_29_9'
)
How can I do this?
print_risn't particularly useful.var_exportwill give a PHP-parseable representation of built-in data types.