Is there anyone who extends php functionality by adding new functions to php source code?

by adding a c method to the source code of php, and then compiling it into an os or dll file, replacing the original extension, can you add your own function to the system?

notice that I"m talking about C extensions.


in most cases, using C extensions to develop your own functionality is not a good choice. Notice that I'm talking about my own function.

of course, there are many excellent open source projects that are done with C extensions, such as yaf, Phalcon.

but if you can't solve the problem with php alone in your php project, there are more options, such as writing services such as C or java to php to call.

if you really want to do this, there are many examples online (including the open source project I mentioned above). You can also take a look at this https://codeshelper.com/a/11.

.

ps. I have personally written about hello world and a custom encryption and decryption function, but I have never played like this.


Yes, what you think is correct. Note that this is not the PHP source code, but the C language source code of the PHP kernel.

as @ tim1020 said, there are indeed some PHP extensions implemented by C #. For example, the popular Swoole, is essentially an extension of PHP.

but if you have such a deep understanding of the C reputation, and have not studied the kernel of PHP, it is easy to produce BUG if you do not recommend writing it yourself.


Kernel source code is not recommended to be modified, just write an extension

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea3561-47a10.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea3561-47a10.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?