Hi
I retrieve a string of data from a database and store the string into my $xml variable. The string mimics a node from an XML file.
I have provided a typical example of what one of the strings could look like below:
$xml = '<question><id="1" answer="|~start~|text one|~end~||~start~|text two|~end~||~start~|text three|~end~||~start~|text four|~end~|" timecheck="267"></question>'
Now, when a user submits a HTML form, all of the form field data is stored into the answer element of the $xml node and is separated by my own delimiters explained below.
The start delimiter is |~start~|
The end delimiter is |~end~|
...and I need help to store the content between every occurrance of these delimiters into an array.
Can some guru out there offer help and explain/provide code on how to do this? I think it will be done with preg_match but this is not an area I am very knowledgeable in im afraid.
For guidance, from the above example, I hope to have the following array outputted:
Array
(
[0] => text one
[1] => text two
[2] => text three
[3] => text four
)
Many Thanks for reading