FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Help me split up this string
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Help me split up this string [message #171054] Sun, 19 December 2010 21:13 Go to next message
ngardner is currently offline  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 Go to previous message
ngardner is currently offline  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,' ','"');
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: cPanel Filter Email Pass-Thru Technique?
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 01:03:23 GMT 2024

Total time taken to generate the page: 0.03060 seconds