|
For mysterious reasons, I came across this old hack of mine, and was able to rewrite it as a one liner:
print str_replace('<font size=-2> </font>', ',' ,
preg_replace('{.+.+= (.+?).+}s', '$1',
file_get_contents('http://www.google.com/search?q=' .
urlencode(join(' ', array_splice($argv, 1)))))) . "\n";
To answer AdamJacobMuller, I use str_replace() instead of strip_tags() to insert pretty commas as thousands separators. Totally unnecessary, I know, but I think it makes the output more readable.
|