I have a string similar to this….
$string = "order apples oranges pears and bananas from username";
How can I get it into something like this?
$products = "apples oranges pears and bananas";
$username = "username";
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.
outputs:
but this will not handle different “commands” other than “order” and also assumes all whitespace between words is a single space character. You need more complex code to handle multiple cases, but that would require more information from you.