I want to tokenize a string in PHP that contains quoted strings that should be kept togethe. For example the original string is...
programming php "hello world"
I want the following result...
[1] programming
[2] php
[3] hello world
If I use strtok(), split(), or explode() I get
[1] programming
[2] php
[3] "hello
[4] world"
I could write code to look at each character checking for blanks and quote marks, replacing the former with something unique and removing the quotes, then use strtok() or the like, but I thought that maybe there was a built-in PhP function that works like the C command-line parser (or Google) which treats search string like this.
Thanks. I posted this to a forum yesterday, but can't find it and have got no replies.