Hi there,
I should split a string with a space as a delimeter but ingoring the space if it is in quotes. Any ideas how this kind of script could be done?
An example how the script should work:
$originalstring = "Word1 Word2 \"Word3 Word4\"";
// Now splitting $originalstring to an array $arrayx
// When printing the items of $arrayx...
echo $arrayx[0]; // Would output "Word1"
echo $arrayx[1]; // Would output "Word2"
echo $arrayx[2]; // Would output "Word3 Word4"
That's it. Hope that you got what I mean, it's a bit difficult to explain... 😉
Cheers,
- Ville