Creating and installing custom php functions

I would like to know how to create a php function that can be installed in php as well as already built functions:

rename
copy 

The main point I would like to get is a simple php function that can be called from ANY php page to the entire host without having to have a php function inside the php page / need to be included.

so simple I would like to create a function that will work as follows:

location();

The fact that without a given input line will output the current file location via echo, etc.

+3
source share
3 answers

, . - , . PHP, C Zend Engine . , , , , .

PHP, helper_functions.php. php.ini : auto_prepend_file = helper_functions.php. , include_path ( php.ini).

, include 'helper_functions.php'; script. , .

auto_append_file.

+9

So, you want to extend the main PHP language to create a function with a name location()written in C that can be executed in PHP:

echo __FILE__;

Right Enjoy it.

-2
source

Source: https://habr.com/ru/post/1739472/


All Articles