79604295

Date: 2025-05-03 01:52:45
Score: 1.5
Natty:
Report link

You can turn this into a single explode() script.

Do a str_replace() with any of the two separators you are dealing with, so now you are facing a string with only one separator. Let's say you have a string like "banana, apple ! pineapple, melon". If you do str_replace($str, '!', ',') you will have "banana, apple, pineapple, melon" and then you can do a explode($str, ',') and it will give you your array!

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: José Leite da Cruz