Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP source code for inbuilt functions

Tags:

php

Is PHP written in C ? Where can i find the PHP source code online without having to download all of it ?

like image 260
aziz punjani Avatar asked Oct 14 '11 14:10

aziz punjani


People also ask

How many built-in functions are there in PHP?

PHP has over 1000 built-in functions that can be called directly from within a script to perform a specific task in PHP Functions.

Can we write function inside function in PHP?

You can also define a function within another function and logically this too should be a local variable but recall the rule that all functions are global. In PHP inner functions are global and hence behave in the same way as if they had been declared outside of any containing function.


2 Answers

PHP functions are written in C - you can find the browsable source code at lxr.php.net.

For example: http://lxr.php.net/opengrok/xref/PHP_5_3/ext/standard/array.c#1242

PS: Usually you can find function definitions just by typing the function name in the search. With commonly used function like in_array you will get loads of other results though. In this case just search for "PHP_FUNCTION in_array" (with quotes).

like image 69
NikiC Avatar answered Sep 26 '22 14:09

NikiC


ALL in-built functions in PHP are written in C - the source language for PHP. All the PHP source is freely available. Just choose a "source" package when you're downloading from PHP.net.

like image 36
DaveRandom Avatar answered Sep 25 '22 14:09

DaveRandom