(only the first # is a delimiter)
50#some message from me to you #1 or #2
into
array
(
[amount] => 50
[message] => 'some message from me to you #1 or #2'
)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
See explode for more details.
If your query does end up getting more complex, then look at preg_split.