Home > Backend Development > PHP Tutorial > A complete list of the most commonly used built-in functions in PHP

A complete list of the most commonly used built-in functions in PHP

怪我咯
Release: 2023-03-11 17:02:01
Original
8091 people have browsed it

$_SERVER['SCRIPT_NAME'] returns /mantis/test.php, relative path;

__FILE__ returns the absolute path of the file D:\Projects\mantis\test.php

$_SERVER['HTTP_X_FORWARDED_PROTO']

$_SERVER['HTTPS']

##$_SERVER['SERVER_PORT']


$_SERVER["REQUEST_URI"] URI is used to specify the page to be accessed


$GLOBALS A global combination array containing all variables. The name of the variable is the key of the array.


explode Uses one string to split another string to return an array of strings


implode Uses one character to concatenate array elements into a string


$_SERVER['SERVER_NAME'] Host name of the server where the current script is located


$_SERVER['HTTP_HOST'] Domain name


$_SERVER['SERVER_ADDR'] The IP address of the server where the current script is located


trim removes the blank characters at the beginning and end of the string


basename returns the file name part


dirname returns Directory part


krsort — Sort the array in reverse order by key name

set_time_limit() sets the maximum execution time of the script

time() returns the current unix timestamp

is_string() determines whether the variable is a string

is_bool

is_Inteter

is_float

strtotime -- Convert the date of any English text The time description is parsed as a UNIX timestamp

file_exists Check whether the file or directory exists

fopen()Open the specified file or URL

feof()Determine whether the file pointer is At the end

fgets() reads a line from the file pointer

trim() removes the spaces before and after a line

strlen() returns the length of the string

str_replace

isset
str_replace( "\0", '', $t_self ) Replaces \0 in t_self with ""
strpos — Find the first occurrence in the string
$ _SERVER['SERVER_SOFTWARE'] Server information
realpath Returns the normalized absolute path name
DIRECTORY_SEPARATOR Operating system directory separator
PATH_SEPARATOR is a ":" sign in Linux systems, and a ";" sign on Windows
set_include_path Set include_path

get_include_path Get the current include_path

count() returns the array length, non-array returns 1

substr(string string,int start [ int length]) Returns a string of length starting from the position specified by start

$_SERVER['LOCAL_ADDR'] Used on IIS7 to obtain the server IP address
$_SERVER['REMOTE_ADDR'] The IP address of the browser user
array_pad — pads an array to the specified length with values ​​
memory_get_usage() returns the amount of memory allocated to PHP
spl_autoload_register registers the __autoload() function
ob_get_contents() Returns the contents of the output buffer
strtolower() Convert uppercase letters to lowercase letters
extension_loaded('zlib') Find out whether the extension is loaded
ini_get Returns the value of the configuration item in php.ini
ini_set Sets the configuration item in php.ini The value of ini_set("memory_limit",'256M'); only takes effect during script execution. The value is reset after the script is executed.
PHP_EOL PHP line terminator

preg_replace executes a regular expression Formula replacement

preg_match(string pattern, string subject [, array matches [, int flags]]) -- Regular expression matching

htmlspecialchars Convert special characters to HTML entities

ceil() Rounding method
floor() Rounding method
round() Rounding method


The above is the detailed content of A complete list of the most commonly used built-in functions in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template