PHP wrapper functions in Drupal 10
Same name and namespace in other branches
- 8 core/includes/common.inc \php_wrappers
- 7 includes/common.inc \php_wrappers
- 9 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 17 - Common functions that many Drupal modules will need to reference.
Functions
Name | Location | Description |
---|---|---|
drupal_register_shutdown_function |
core/ |
Registers a function for execution on shutdown. |
FileSystemInterface:: |
core/ |
Gets the filename from a given path. |
FileSystemInterface:: |
core/ |
Sets the permissions on a file or directory. |
FileSystemInterface:: |
core/ |
Gets the name of the directory from a given path. |
FileSystemInterface:: |
core/ |
Creates a directory, optionally creating missing components in the path to the directory. |
FileSystemInterface:: |
core/ |
Moves an uploaded file to a new location. |
FileSystemInterface:: |
core/ |
Resolves the absolute filepath of a local URI or filepath. |
FileSystemInterface:: |
core/ |
Removes a directory. |
FileSystemInterface:: |
core/ |
Creates a file with a unique filename in the specified directory. |
FileSystemInterface:: |
core/ |
Deletes a file. |
Unicode:: |
core/ |
Converts the first character of a UTF-8 string to lowercase. |
Unicode:: |
core/ |
Capitalizes the first character of each word in a UTF-8 string. |
UrlHelper:: |
core/ |
Parses an array into a valid, rawurlencoded query string. |
UrlHelper:: |
core/ |
Parses a URL string into its path, query, and fragment components. |