I recently installed a liip version of PHP, and I feel that many functions are more interesting than native ones. Can I customize some built-in functions. If yes, can I post a method? Thank you very much. I recently installed a liip version of PHP, and I feel that many functions are more interesting than native ones. Can I customize some built-in functions. If yes, can I post a method? Thank you very much.
Reply content:
I recently installed a liip version of PHP, and I feel that many functions are more interesting than native ones. Can I customize some built-in functions. If yes, can I post a method? Thank you very much.
The answer above is a little more difficult (C is required)
In fact, there is a pure PHP Solution for PHP programmers.
In php. ini, there is a configuration item auto_prepend_file. You can set a php file as the file automatically loaded before each execution.
Write a function in this file and you can use it as a custom built-in function.
Write a PHP extension here
Any built-in function requires some underlying extensions of the C Language
@ Chenhengqi the answer is to write the PHP 7 extension. For more information about the extension development before php7, see here.
PHP extension development and getting started
Override_function
Http://php.net/manual/zh/function.override-function.php
Extensions need to be installed