Can anyone assist in the following. I have a field “notes” inside a mysql table but need to separate it to a new table.
The note is currently in this format:
Added by username1 on 22/10/2012 3:50pm
The note is here
Added by username2 on 20/10/2012 12:29pm
The note is here and so on
There’s 2 notes here as an example. How can I get this into an array thus:
[0] => Array(
[0] username1
[1] 22/10/2012 3:50pm
[2] Note1
)
[1] => Array(
[0] username2
[1] 20/10/2012 12:29pm
[2] Note2
)
I tried using preg_split but it only returns note if split by “Added by username on date-time” because I can’t use “Added by” on its own to split it as the note itself might contain “Added by”
What would be be the best way to do this?
Thanks
Try this
This should give you the base to work on. You can also check for empty lines in the notes element
$final[$key][2] .= $element;