I've tried to handle this a few ways, and none of them seem to work.
Warning: preg_replace() [function.preg-replace]: Empty regular expression in /home/content/index.php on line 32
$_SESSION['keywords'] = get_search_phrase($_SERVER["HTTP_REFERER"]);
$key = $_SESSION['keywords'];
if (empty($key)) {
$key = "nokeywords";
}
$words = preg_replace(" ", "0", $key); //replace any spaces with "0".
Now I've also tried it this way....
$_SESSION['keywords'] = get_search_phrase($_SERVER["HTTP_REFERER"]);
$key = $_SESSION['keywords'];
if ($key == "") {
$key = "nokeywords";
}
elseif ($key == NULL) {
$key = "nullkeywords";
}
$words = preg_replace(" ", "0", $key); //replace any spaces with "0".
Neither one worked...
Maybe there's an easier way to do it? What I'm actually trying to accomplish is to strip out ANY character in the variable that is not alpha/numeric. I only want numbers and letters in the strings. I know I'm only currently going after spaces, but maybe there's an easier function to accomplish this that I'm unaware of.
Thanks for your input in advance.