Home >Backend Development >PHP Problem >What are the interesting functions in php?
Interesting functions in php include: 1. cli_set_process_title function; 2. memory_get_peak_usage function; 3. memory_get_usage function; 4. get_cfg_var function, etc.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What are the interesting functions of php?
Some interesting functions of php:
cli_set_process_title('abcd'); Give the current php process a resounding name;
echo cli_get_process_title(); Get the name of the current php process
Only valid in php-cli
The memory_get_peak_usage() function returns the peak memory usage,
memory_get_usage() can return the amount of memory currently allocated to the PHP script
##get_cfg_var('error_reporting'); Get the value of the PHP configuration optionget_current_user() Get the current PHP script owner name, get the computer user name<?php define('TIONCICO','仙士可'); const TIONCICO2='仙士可2号'; function zhuangbi(){ } $tioncico='仙士可'; var_dump(get_defined_constants());//返回所有常量的关联数组,键是常量名,值是常量值 define,const定义的都是常量,类里面的const不会返回,static不会返回 var_dump(get_defined_functions());// 获取php所有internal已有函数以及user自己已经定义的函数 var_dump(get_defined_vars());// 获取php所有已定义变量的数组,包括环境变量,服务器变量,用户变量 var_dump(get_loaded_extensions());// — 返回所有编译并加载模块名的 array var_dump(get_extension_funcs('mysql'));// — 返回模块函数名称的数组 模块是指php扩展,可获取该扩展所有内置的函数An array of all constants, including user-defined
All functions All defined variables, including global variables and user-defined variables All loaded modules mysql module function echo sys_get_temp_dir();//Return to the temporary file directory echo PHP_VERSION;var_dump(version_compare(PHP_VERSION,'5.6','gt'));//Is the current version greater than 5.6
echo highlight_file('1.php'); Highlight output php file code echo php_sapi_name(); // Returns the interface between the web server and PHP Type Recommended learning: "
PHP Video Tutorial"
The above is the detailed content of What are the interesting functions in php?. For more information, please follow other related articles on the PHP Chinese website!