PHP wrapper functions
Same name in other branches
- 7.x includes/common.inc \php_wrappers
- 9 core/includes/common.inc \php_wrappers
- 8.9.x core/includes/common.inc \php_wrappers
- 10 core/includes/common.inc \php_wrappers
Functions that are wrappers or custom implementations of PHP functions.
Certain PHP functions should not be used in Drupal. Instead, Drupal's replacement functions should be used.
For example, for improved or more secure UTF8-handling, or RFC-compliant handling of URLs in Drupal.
For ease of use and memorizing, all these wrapper functions use the same name as the original PHP function, but prefixed with "drupal_". Beware, however, that not all wrapper functions support the same arguments as the original functions.
You should always use these wrapper functions in your code.
Wrong:
$my_substring = substr($original_string, 0, 5);
Correct:
$my_substring = mb_substr($original_string, 0, 5);
File
-
core/
includes/ common.inc, line 15
Functions
Title Sort descending | File name | Summary |
---|---|---|
drupal_register_shutdown_function | core/ |
Registers a function for execution on shutdown. |
FileSystemInterface::basename | core/ |
Gets the filename from a given path. |
FileSystemInterface::chmod | core/ |
Sets the permissions on a file or directory. |
FileSystemInterface::dirname | core/ |
Gets the name of the directory from a given path. |
FileSystemInterface::mkdir | core/ |
Creates a directory, optionally creating missing components in the path. |
FileSystemInterface::moveUploadedFile | core/ |
Moves an uploaded file to a new location. |
FileSystemInterface::realpath | core/ |
Resolves the absolute filepath of a local URI or filepath. |
FileSystemInterface::rmdir | core/ |
Removes a directory. |
FileSystemInterface::tempnam | core/ |
Creates a file with a unique filename in the specified directory. |
FileSystemInterface::unlink | core/ |
Deletes a file. |
Unicode::lcfirst | core/ |
Converts the first character of a UTF-8 string to lowercase. |
Unicode::ucwords | core/ |
Capitalizes the first character of each word in a UTF-8 string. |
UrlHelper::buildQuery | core/ |
Parses an array into a valid query string encoded with rawurlencode(). |
UrlHelper::parse | core/ |
Parses a URL string into its path, query, and fragment components. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.