Re: help with explode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Jan G.B. wrote:
You could try it with regular expression matching..
for example:
<?php
    preg_match_all('/([a-z]+|"[a-z ]+")/i', $searchstring, $resultarray);
?>


Regards

Thanks. That seems to create 2 duplicate arrays, though. Can it be narrowed down to just array [0]?

preg_match_all('/([a-z]+|"[a-z ]+")/i', $_POST["terms"], $termsarray);
echo $_POST["terms"]."<br>";
print_r($termsarray);

displays:

John Jill "Judy Smith"
Array ( [0] => Array ( [0] => John [1] => Jill [2] => "Judy Smith" ) [1] => Array ( [0] => John [1] => Jill [2] => "Judy Smith" ) )


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux