clab/php/README.md
2025-01-08 22:07:16 +00:00

14 lines
1.3 KiB
Markdown

# What?
In this folder you got a set of examples integrating php code and native c code. The idea here is to explore a bit how we can call low level compiled c code in a higher language like PHP. Here we created the examples trying to target some questions related with performance and several ways to solve essencially the same problem.
This folder has a Makefile that can be used to simplify some of the command line needed to compile and run the programs.
If you take a look to the [Makefile](Makefile) you'll notice that **Docker** is being used here. This is to simplify the process of running php scripts on the command line with the [FFI](https://www.php.net/manual/en/book.ffi.php) enabled. This is needed because the FFI is the simplest way we have to enable a quick integration between low level c and higher level php code. In a more professional environment this would be done using [Zend Engine](https://en.wikipedia.org/wiki/Zend_Engine), fortunately this is not a professional environment so additional complexity is avoided.
# Running stuff
How you can run these examples? Glad you asked. Well, makefile right? The one listed on the folder? Yeah you can take a little look at it. Each of the label (below the .PHONY) is a command you can execute by calling `make "label"`.