简体   繁体   中英

small PHP runtime (interpreter) for educational purpose

Is there any small PHP runtime (interpreter) for learning PHP? I think creating my own PHP runtime is a good way to understand how PHP works.

It seems that C language has some toy compilers for learning but I could not find it for PHP.

I prefer the following condition:

  • written in C language
  • compatible x86-64 architecture (Linux)

small c compiler for educational purpose


Update 1

I'm looking for PHP toy compilers for learning the programming language like TCC: Tiny C Compiler. https://en.wikipedia.org/wiki/Tiny_C_Compiler


Update 2

This site shows that PHP has the following execution processes.

1 Lexing
2 Parsing
3 Compilation
4 Interpretation

I want to understand the all processes. I need to read the official interpreter but it seems be difficult for me. So I want to start with smaller one.

Again this may not be what you're looking for;

But I always found installing a mock apache server with PHP was the easiest way to learn PHP (and practise building within an environment in which PHP is most commonly used)

A simple IDE (Notepad ++) and XAMPP (or WAMP) set up will have a local server with the easy ability to use PHP.

XAMPP: https://www.apachefriends.org/index.html WAMP: http://www.wampserver.com/en/

Notepad++: https://notepad-plus-plus.org/downloads/

Like I say; this may not be what you're after...

Yes there is, it's called PH7: https://ph7.symisc.net/

This is a single file embeddable PHP interpreter compatible with approximately 5.3 with some enhancements.

Note however that it does not implement the majority of the PHP standard library.

Rebuild PHP5/7 with:

  1. Maximum number of the extensions disabled.
  2. With optimization (for size) flag on.
  3. Make sure the binary is stripped.

This will technically reduce the size of the interpreter and the number of extensions installed.

You should be able to provide these options during "./configure" step, see "./configure --help" for more information about it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM