Help me split up this string [message #171054] |
Sun, 19 December 2010 21:13 |
ngardner
Messages: 2 Registered: December 2010
Karma: 0
|
Junior Member |
|
|
I need a function that can split up my string by spaces, but with
grouped words based on quotes. For example...
This is "my first" test "query string" to try
should be formatted into an array like...
0=>This
1=>is
2=>my first
3=>test
4=>query string
5=>to
6=>try
Anyone have a function like this, or help me determine the best way to
accomplish this? Thanks!
|
|
|
Re: Help me split up this string [message #171055 is a reply to message #171054] |
Sun, 19 December 2010 21:31 |
ngardner
Messages: 2 Registered: December 2010
Karma: 0
|
Junior Member |
|
|
On Dec 19, 3:13 pm, ngardner <ngardner...@gmail.com> wrote:
> I need a function that can split up my string by spaces, but with
> grouped words based on quotes. For example...
>
> This is "my first" test "query string" to try
>
> should be formatted into an array like...
> 0=>This
> 1=>is
> 2=>my first
> 3=>test
> 4=>query string
> 5=>to
> 6=>try
>
> Anyone have a function like this, or help me determine the best way to
> accomplish this? Thanks!
Found the str_getcsv() function which did this for me.
$keywords = str_getcsv($string,' ','"');
|
|
|