What is PHP core?
Moderator: General Moderators
What is PHP core?
1-What is PHP core?
2-How does it work?
3-What is Zend engine?
4-Which language is used to build PHP core(For PHP 5) and zend engine?
5-What is relationship between C and PHP 5?
2-How does it work?
3-What is Zend engine?
4-Which language is used to build PHP core(For PHP 5) and zend engine?
5-What is relationship between C and PHP 5?
- Ragnis
- Forum Commoner
- Posts: 31
- Joined: Thu Nov 13, 2008 12:35 pm
- Location: Saaremaa, Estonia, Europe, Asia, Planet Earth, The Solar System, Milky way.
Re: What is PHP core?
5. PHP is written in C
Re: What is PHP core?
http://en.wikipedia.org/wiki/Zend_Engine
http://www.zend.com/en/community/php
@Ragnis you sure its not C++ ?
http://www.zend.com/en/community/php
@Ragnis you sure its not C++ ?
Re: What is PHP core?
As far as I can tell, it's written in C.
Re: What is PHP core?
Again: What is PHP core and how does it work?
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: What is PHP core?
A quick checkout from SVN of 5.2:
PHP is indeed (excluding externals) 93.4% written in ANSI C. 
Cheers,
Alex
Code: Select all
469317 ext ansic=450035,sh=8399,php=7377,yacc=1483,tcl=1128, awk=860,pascal=35
63119 Zend ansic=58435,lex=2296,php=1441,yacc=947
19304 main ansic=19304
17619 sapi ansic=16818,cpp=682,php=119
11522 top_dir sh=8417,php=3105
3550 regex ansic=3489,sh=61
3243 win32 ansic=2917,php=326
2677 TSRM ansic=2652,sh=25
1681 build sh=1534,awk=147
931 scripts php=506,sh=387,awk=38
744 tests php=671,perl=71,pascal=2
75 netware ansic=75
64 pear php=64
Totals grouped by language (dominant language first):
ansic: 553725 (93.24%)
sh: 18823 (3.17%)
php: 13609 (2.29%)
yacc: 2430 (0.41%)
lex: 2296 (0.39%)
tcl: 1128 (0.19%)
awk: 1045 (0.18%)
cpp: 682 (0.11%)
perl: 71 (0.01%)
pascal: 37 (0.01%)
Cheers,
Alex
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: What is PHP core?
Your asking the wrong crowd, most of us are primarily interested in using PHP not building it. The architecture is complex and highly optimized. You could probably learn a great deal by sifting through the code, implementing some basic extensions, etc. I have Googled many times in the past and found very little on the subject so I suspect your in for the same ride.Again: What is PHP core and how does it work?
So again, start Googling.
Cheers,
Alex
Re: What is PHP core?
The core of the code in written in C, however extensions and the like can be written in C++. The difference between to two, as far as this forum goes, is negligible.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: What is PHP core?
You might be bale to, but would it make sense to use C++? I recall the extension API having to confirm to a specific calling convention (which C++ could do) but then there is the issue of resolving the *this* pointer.The core of the code in written in C, however extensions and the like can be written in C++.
So the API would almost certaily have to be built as a C library and the implementation of each function could use objects internally, but at that point, I would just stick with C.
Cheers,
Alex
Re: What is PHP core?
Your asking the wrong crowd, most of us are primarily interested in using PHP not building it. The architecture is complex and highly optimized. You could probably learn a great deal by sifting through the code, implementing some basic extensions, etc. I have Googled many times in the past and found very little on the subject so I suspect your in for the same ride.
Thanks for answer, But of course someone here work with PHP core and help me
Re: What is PHP core?
I don't remember entirely how it works, it's been about two years since I looked into writing my own extension, but I know it involved C++, because at this point thinking in C terms (aka procedurally) instead of c++ (OO) makes my head hurt.PCSpectra wrote:You might be bale to, but would it make sense to use C++? I recall the extension API having to confirm to a specific calling convention (which C++ could do) but then there is the issue of resolving the *this* pointer.The core of the code in written in C, however extensions and the like can be written in C++.
So the API would almost certaily have to be built as a C library and the implementation of each function could use objects internally, but at that point, I would just stick with C.
Cheers,
Alex
Re: What is PHP core?
I have a book called "Extending & Embedding PHP". I didn't read it yet but the index implies the 'core' is related to the following topics: core globals, core php functions (error reporting, misc, open basedir, output, reentrancy safety, safe mode, startup/shutdown,string formatting).
Re: What is PHP core?
How does PHP core work?
I want to know what happened behind. Please show me by a simple PHP code, What happened in PHP core when that code runs.
I want to know what happened behind. Please show me by a simple PHP code, What happened in PHP core when that code runs.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: What is PHP core?
Did you read the posts by everyone?abalfazl wrote:How does PHP core work?
It's not written in PHP, it's written in C.abalfazl wrote:... Please show me by a simple PHP code ...
Re: What is PHP core?
I think he wants help visualizing the parse tree that the php core seems like it would have to build.