Getting rid of the 'e' seemed to solve the problem.
Although I'm not sure why.
preg_replace("/\s/" , "_" , $url));
User Profile
Collapse
-
regular expression to replace space by underscore
I am using the following code to replace spaces with "_" for my URL rewriting
function.
$url = urlencode(preg_ replace("/\s/e" , "_" , $url));
It get thrown the following error and can't figure out what it's trying to tell me,
Notice: Use of undefined constant _ - assumed '_' in : regexp code on line 1
Help!
(Note: I'm using PHP... -
That is close to what I am looking for.
However, I need the date $val and the count $val to have seperate
variables.
I am inserting both of them into seperate rows of my mysql database.Leave a comment:
-
That looks right to me.
Any clue how to loop through it and print each result?
Thanks,Leave a comment:
-
$api = new duckSoup; // create a new object
$api->api_key = "XXX"; // your API key
$api->type = 'dailycounts'; // what API?
$api->params = array('q' => ''.$name.'','da ys' => '7'); // the parameters
$content = $api->get_content( ); // The 'content' Array
print_r($conten t);Leave a comment:
-
Printing out results from an array.
I am relatively new to php and am struggling with printing out each result from the
following array.
Array ( [result] => Array ( [queryterm] => Britney Spears [days] => 7 [searchurl] => http://technorati.com/search/Britney+Spears ) [item] => Array ( [0] => Array ( [date] => 2008-02-24 [count] => 889 ) [1] => Array ( [date] => 2008-02-23 [count] => 2403 ) [2] => Array ( [date] => 2008-02-22... -
-
PHP RegExp Help!
I have the following regular expression which is stripping all unwanted characters before sending a variable to a url.
$url = preg_replace('~[^\\pL0-9_]+~u', '_', $url);
The problem is I would like to keep single quotation marks or encode them for the url so that I may retrieve them on the next page. The function above is currently getting rid of all single quotes.
I hacked this together and am not sure... -
How to get Subdomain with parse_url()
I am using the following function and parse_url() to attempt to grab the subdomain from my sites url
[code=php]
function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolo wer($_SERVER["SERVER_PROTOCO L"]), "/").$s; $port = ($_SERVER["SERVER_POR T"] == "80") ? "" :...
No activity results to display
Show More
Leave a comment: