Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check php function source code using eclipse

I'm curious on how certain php functions are implemented internally. e.g. array_values().

So in eclipse, I control click on the function name, which took me to a page that contain function prototype definition, but contains no internal source code.

enter image description here

Is there any way to see the internal implementation of php function using eclipse? (whether the function is written in php or c)

If it is not possible to see the php source code using eclipse, then does anyone have any good strategies at searching through the php source code on github?

like image 385
Thor Avatar asked Apr 22 '18 22:04

Thor


2 Answers

Is there any way to see the internal implementation of php function using eclipse?

Unfortunately, no.

what is the best search strategy to search through the php source code, especially for a beginner like me, who feels very much lost in the vast amount of php source code

I'm assuming what you are really after here is a reference for native PHP functions and their input parameters and out types. In which case the official documentation is probably the best way to go about it.

Some (most?) popular IDEs such as Eclipse and Phpstorm can also give you an auto-generated phpdoc block for PHP's built-in functions that will give that information directly in your IDE.

If you are interested in the actual C implementation of most php functions, you can either navigate through the GitHub repository directly or clone it on your computer and open it in an IDE (Eclipse, CLion, etc...) and use the IDE navigation.

like image 100
William Perron Avatar answered Nov 06 '22 12:11

William Perron


You can download the PHP source code from GitHub (https://github.com/php/php-src) but the core of PHP is written in C language. Use notepad++ to search the required details from the downloaded source code. For example code for PHP array will be in this file : https://github.com/php/php-src/blob/master/ext/standard/array.c

Notepad++ is the good editor with a lot of additional functionality like search string through files. (Find in files) Hope it helps Thanks

like image 4
yuvraj Avatar answered Nov 06 '22 14:11

yuvraj