clab/php
2025-01-08 23:42:50 +00:00
..
Dockerfile On php ffi and performance examples 2025-01-08 16:02:19 +00:00
heavy_stuff.c On php ffi and performance examples 2025-01-08 16:02:19 +00:00
heavy_stuff.php Ref 2025-01-08 23:42:50 +00:00
heavy_stuff_c.php Ref 2025-01-08 23:42:50 +00:00
heavy_stuff_opt_c.php Refactorings 2025-01-08 23:36:15 +00:00
lesser_heavy.php Ref 2025-01-08 23:42:50 +00:00
main.c Refactorings 2025-01-08 23:36:15 +00:00
Makefile Ref 2025-01-08 23:37:05 +00:00
README.md More readme 2025-01-08 22:07:16 +00:00

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 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 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, 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".