PHP Manual

Data Output

String Output String Output

Conditional Constructs

Conditional Operator Alternative Condition Additional Condition Multiple Choice Selection Option Default Option Matching

Loops

Conditional Loop Loop with Postcondition Counter Loop Loop Over Array Loop Break Loop Continuation

Working with Variables

Existence Check Check for Emptiness Deleting a Variable Array Creation

Shutdown

Exit with Output Shutdown
determining variable type changing variable type checking for an integer checking for a floating-point number checking for a numeric value checking for a string checking for a boolean value checking for an array checking for an object checking for NULL value checking for a resource checking for a callable value checking for an iterable value checking for a countable value casting to integer casting to float casting to string casting to boolean converting to an array

Mathematical Functions

absolute value of a number power of a number square root of a number largest value smallest value rounding a number rounding up rounding down fractional remainder of division random number

String Measurement

string length string length string width

Manipulations

trimming edges trimming the start trimming the end padding a string repeating a string reversing a string shuffling characters

Case

lowercase uppercase lowercase uppercase first character to uppercase first character to lowercase first character of a word to uppercase

Splitting

splitting a string into an array splitting a string into an array splitting a string into parts splitting a string into variables splitting a string into tokens parsing a string according to a format splitting a multibyte string splitting a string into characters getting a part of a string trimming a string to a width

String Parts

getting a substring getting a substring

Search and Replace

search and replace case-insensitive replacement search and replace replacing part of a string

String Search

checking for a character in a string checking for the first occurrence checking for the last occurrence position of the first occurrence of a substring position of the last occurrence of a character case-insensitive search case-insensitive reverse search finding the first occurrence of a substring searching for any given character in a string finding the first occurrence of a character finding the last occurrence of a character case-insensitive search case-insensitive substring search substring position searching for the last occurrence case-insensitive search for the last occurrence case-insensitive reverse search reverse substring search searching for the first occurrence

Counting by String

counting the number of substring occurrences counting occurrences counting the number of characters counting the number of words

Working with Tags, Escaping

removing tags from a string outputting tags to the browser reverse operation of htmlspecialchars converting characters to HTML entities reverse operation of htmlentities escaping quotes in a string removing escaping added by the addslashes function escaping metacharacters replacing invalid characters

String Formatting

number formatting formatting monetary amounts outputting a formatted string outputting a formatted string formatting a string (with return)) formatting a string from an array inserting a line break inserting a line break

Character Codes

character by code character code

String Comparison

Levenshtein distance between strings percentage of string similarity phonetic string comparison improved soundex comparing the first characters of strings case-insensitive comparison of the first characters case-sensitive string comparison locale-based string comparison natural string comparison natural case-insensitive comparison case-insensitive string comparison

Arrays

number of elements array with a range sum of array elements product of elements slicing an array merging arrays recursive array merging keys to values selecting array keys selecting array values merging arrays searching an array counting the quantity replacement in an array reversing an array removing duplicates random key shuffling an array presence check presence check array into variables array into variables merging an array into a string into a multidimensional array first element of an array last element of an array adding to the beginning adding to the end padding an array filling an array filling an array

Sorting

in ascending order of elements in descending order of elements in ascending order of keys in descending order of keys in ascending order of elements while preserving keys in descending order of elements while preserving keys in natural order natural case-insensitive order by callback by callback on keys by callback while preserving keys sorting multiple arrays

Callbacks

modifying an array iterating an array iterating over a multidimensional array filtering an array array reduction

Array Intersection

array intersection intersection of arrays with keys intersection by keys intersection with callback comparison intersection with callback comparison intersection with callback on keys intersection of keys with callback

Array Difference

array difference array difference with keys array difference with difference by keys difference with callback comparison difference with callback on keys key difference with callback

Basic Functions

Finding a Match Finding All Matches Replacement by Pattern Filtering with Replacement

Additional Functions

Splitting a String Replacement with Callback Function Multiple Replacement Array Filtering Character Escaping

Error Handling

Getting Error Code Getting Error Text

Functional Style

current moment as timestamp given moment to timestamp date formatting converting a date to a timestamp getting microseconds checking date validity creating a date object adding and subtracting dates adding to a date subtracting from a date creating an interval date formatting difference between two dates setting the timezone getting the timezone

OOP Style

object with date immutable date-time intervals between dates time zones period between dates adding to a date subtracting from a date

DateTime Methods

Create from Format Convert Immutable Format Date Date Difference Modify Date Add Interval Subtract Interval Set Date Set ISO Date Set Time Set Timestamp Set Timezone Get Timezone Get Offset Get Timestamp Parsing Errors

DateInterval Methods

Create from String Format Interval

Basic

getting file contents writing a string to a file file to array

File Operations

deleting a file copying a file renaming a file or folder creating a temporary file creating a file with a unique name

Folder Operations

creating a folder deleting a folder checking for a folder reading contents reading content according to a pattern available space total folder size

Checks

checking for file or folder existence checking for a file checking if a file is readable checking if a file is writable checking for an executable file

File Paths

folder name from path file name from path absolute file path file path information

Information

getting file size changing file permissions changing file owner changing file group setting modification time file modification time file creation time file access time determining MIME type MIME-file type clearing stat cache

Including Files

Including a File One-Time Inclusion Mandatory Inclusion One-Time Mandatory Inclusion

Low-Level Files

opening a file or URL reading a file reading a line from a file reading a character from a file writing to a file closing a file handle reading a file checking for end of file moving within a file resetting file pointer truncating a file position in a file outputting the remainder of a file

Low-Level Folders

reading contents opening a folder closing a folder

Special Files

reading a CSV file writing a CSV file reading an INI file

File Uploads

determining file upload moving an uploaded file to a new location

Miscellaneous

file locking formatted output to a stream formatted output of an array to a stream

Existence Check

Checking for Class Existence Checking for Method Existence Checking for Property Existence Checking for Trait Existence Checking for Interface Existence

Getting Class Information

Getting Class Name Getting the Parent Class Getting Class Methods Getting Class Properties Getting Object Properties Getting the Calling Class

Type and Relationship Checks

Checking Object Type Checking Class Membership Checking Class Inheritance List of Class Interfaces List of Parent Classes List of Used Traits

Class Autoloading

Determining a Namespace Registering an Autoloader Getting Autoloaders Removing an Autoloader Calling an Autoloader

Working with Declarations

Creating a Class Alias Getting Declared Classes Getting Declared Interfaces Getting Declared Traits

Creation

Object Creation Class Declaration Interface Declaration Trait Declaration

Calls

static call static call with an array

Basic Magic Methods

Object Constructor Object Destructor Object Cloning

Property Access

Reading Properties Writing Properties Property Check Deleting a Property

Intercepting Calls

Method Call Static Call Call as Function

Serialization

Preparation for Serialization Object Restoration Modern Serialization Modern Deserialization

Converting Objects

To String For var_export For var_dump

Exception Handling

Processing Block Catching an Exception Final Actions Exception Generation Base Exception Class Treating Errors as Exceptions

Functions

configuring error output writing to error log call trace printing a trace registering a shutdown function Xdebug call stack generating a user-defined error analog of trigger_error setting the exception handler setting the error handler restoring the error handler restoring the exception handler

Function Checks

checking for function existence checking for callability

Calling Functions

calling a callback function call with an array of arguments

Working with Arguments

getting arguments counting arguments getting a specific argument

Event Handling

registering a tick function canceling a tick function

Variables

outputting variable information convenient variable output

Lists

list of all variables list of all constants list of all functions list of included files

Memory

current memory usage peak memory usage
JSON decoding encoding to JSON data serialization data deserialization exporting a variable

Settings

setting a configuration value getting a configuration value getting all settings information about settings

Extensions

list of loaded extensions checking if an extension is loaded extension functions

Information

language version version comparison
byenru