Code Snippets Part of Universal Search
April 6th, 2008 by Michael Gray in GoogleIf you're new here, you may want to subscribe to my RSS feed. Read my top posts or learn more about Michael Gray. Want more frequent updates follow me on Twitter. Thanks for visiting!
I’ve never seen this before a code snippet as part of a Google Universal Search Result

Sphere It










April 6th, 2008 at 4:57 pm
Wow, that is pretty wild. Maybe soon we can just Google for PHP script and have the whole code come up in search results. Looks like Google moving to Artificial Intelligence..:)
April 7th, 2008 at 12:26 am
Let’s see if they purposely leave out code snippets for any .NET code
April 7th, 2008 at 9:35 am
I think this feature was intended to be useful for programmers. It’s not. I don’t like it. The results are crappy one-liners from Google Code, exposed out of context. It sometimes gives you a sample of usage and syntax, but for a function name like “strlen” I’d much rather get a wikified “hello world” sample or a generic definition.
For “strlen”, this would have been much more useful nugget to expose:
STRLEN - PHP
int strlen ( string $string )
Returns the length of the given string.
[example]
$len = strlen(”hello world”);
// $len is 11
[/example]
I see code snippets also when I search other function names like indexOf, createNode, strstr, strrev, and mysql_query, and other common Javascript and PHP functions.
April 7th, 2008 at 11:12 am
Ha, ha! I rather go to Php.net and find some real code, like classes and other functions. I do find some snippet scripts around on different forums, but take a bit of time to search for them.
Who knows, Google doing Viral? Or maybe they will open up their code base, but is it built like a code language dictionary? I doubt it!
Maybe Google will just curl_init() Php.net and other forums like phpfreaks and serve it as their own. Anything possible with Google. They have done it to news, books, and video.
Evil Google!