tags:

views:

25

answers:

2

PHP's C source can be found at http://svn.php.net/viewvc/php/php-src/trunk/. If I want to find the implementation of a specific PHP function, how to quick locate it in that SVN source?

+2  A: 

Checking out the repository (or extracting the tarball), and greppign for PHP_FUNCTION(functionname) should do it.

For example:

$ grep -Rn "PHP_FUNCTION(implode)" *
ext/standard/php_string.h:40:PHP_FUNCTION(implode);
ext/standard/string.c:1131:PHP_FUNCTION(implode)

Line 1131 of ext/standard/string.c is where implode is defined.

Or you can use http://lxr.php.net/.

racetrack
+1  A: 

Checkout the sources and run some kind of indexer (like etags) on the tree. Then you should be able to find a definition quite quickly. This assumes that there's some naming convention in place such that a PHP inbuilt function like "do_this" has a corresponding name in C like "C_do_this" which you can use as a mapping rule.

Noufal Ibrahim