(only the first # is a delimiter)
50#some message from me to you #1 or #2
into
array
(
[amount] => 50
[message] =>开发者_JS百科 'some message from me to you #1 or #2'
)
You don't need regex for such a simple split. The following will split your string correctly:
explode('#', $string, 2)
This will return an array like:
Array
(
[0] => '50'
[1] => 'some message from me to you #1 or #2'
)
See explode for more details.
If your query does end up getting more complex, then look at preg_split.
精彩评论