Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
PHP Articles
Page 14 of 81
PHP – grapheme_strlen() function
A grapheme is the smallest functional unit of a writing system. Graphemes can be interpreted as the smallest units of writing that correspond with sounds. The grapheme_strlen() function in PHP is used to get the string length in grapheme units. This function does not get the byte or character's length but counts the actual displayed characters, making it useful for Unicode text with combining characters. The grapheme_strlen function is supported in PHP 5.3.0 and higher versions. Note: The Intl extension must be installed and enabled to use this function. Syntax int grapheme_strlen(string $input) ...
Read MorePHP – idn_to_ascii() function
The idn_to_ascii() function in PHP is used to convert a Unicode domain name into IDNA ASCII form. IDNA stands for Internationalizing Domain Names in Applications. It is a mechanism for handling internationalized domain names containing non-ASCII characters. Syntax string idn_to_ascii( string $domain, int $flags = IDNA_DEFAULT, int $variant = INTL_IDNA_VARIANT_UTS46, array &$idna_info = null ) Parameters idn_to_ascii() accepts the following four parameters − $domain − This is the domain to be converted; it must be UTF-8 encoded. $flags − This ...
Read MorePHP – exif_imagetype() function
The EXIF (Exchangeable image file format) PHP extension enables you to work with metadata from images taken by digital devices like digital cameras and cell phones. The exif_imagetype() function determines the type of an image by reading its first bytes and checking its signature. This is useful for validating file types before processing or checking browser compatibility. Syntax int exif_imagetype(string $filename) Parameters The function accepts a single parameter: $filename − Path to the image file to check Return Value Returns an integer constant representing the image type when a ...
Read MorePHP – exif_read_data() function
The exif_read_data() function in PHP reads the EXIF (Exchangeable image file format) headers from an image file. This function extracts metadata information such as camera settings, GPS coordinates, timestamps, and technical details from JPEG and TIFF images. Note: This function requires the EXIF extension to be enabled in PHP. On most systems, it's enabled by default, but you can check with extension_loaded('exif'). Syntax array|false exif_read_data( string $file, string $sections = null, bool $arrays = false, bool $thumbnail = false ) ...
Read MorePHP – How to get or set the path of a domain?
The bindtextdomain() function in PHP is used to set or get the path of a domain for internationalization (i18n) purposes. It binds a message domain to a specific directory containing translation files. Syntax string bindtextdomain(string $domain, string $directory) Parameters bindtextdomain() accepts two parameters − $domain − The message domain name (typically your application name). $directory − The directory path where translation files are stored. If NULL, it returns the currently set directory for the domain. Return Value bindtextdomain() returns the full pathname for the domain directory currently set, or ...
Read MorePHP – mb_ereg_search_init() function
The mb_ereg_search_init() function in PHP initializes the string and regular expression pattern for multibyte regular expression searches. It prepares the search parameters that will be used by subsequent functions like mb_ereg_search(), mb_ereg_search_pos(), and mb_ereg_search_regs(). Syntax bool mb_ereg_search_init( string $string, string $pattern = null, string $options = null ) Parameters mb_ereg_search_init() accepts three parameters − string − The target string to search in. pattern − The regular expression pattern (optional). options − Search options like "i" for case-insensitive matching (optional). Return Value ...
Read MorePHP – mb_strcut() function
The mb_strcut() function in PHP is used to extract a substring from a string based on byte positions rather than character positions. This is particularly useful when working with multi-byte character encodings like UTF-8, where a single character might use multiple bytes. Syntax string mb_strcut( string $str, int $start, int $length = null, string $encoding = null ); Parameters The mb_strcut() function accepts the following parameters − str − The input string to be cut. start − The starting byte ...
Read MorePHP – mb_strrichr() function
The mb_strrichr() function in PHP is used to find the last occurrence of a character in a string within another string. This function is case-insensitive, unlike mb_strrchr(). This function finds the last occurrence of a needle in the given haystack string and returns that portion of the haystack. It returns false if a needle is not found in the haystack string. Syntax string mb_strrichr( $str_haystack, $str_needle, $bool_before_needle=false, $str_encoding ) Parameters mb_strrichr() accepts the following four parameters − ...
Read MorePHP – mb_eregi() function
The mb_eregi() function in PHP performs case-insensitive regular expression matching with multibyte support. Unlike mb_ereg(), it ignores case when comparing patterns, making it useful for international text processing. Syntax int mb_eregi( string $pattern, string $string, array &$matches = null ) Parameters pattern − The regular expression pattern to match (case-insensitive) string − The input string to search within matches − Optional array to store matched substrings. If matches are found, they are stored in this array Return Value Returns the number ...
Read MorePHP – mb_strrpos() function
The mb_strrpos() function in PHP is used to find the position of the last occurrence of a string in another string. This function performs the multibyte safe strrpos() operation based on the number of characters and is particularly useful when working with multibyte character encodings like UTF-8. Syntax int mb_strrpos( string $haystack, string $needle, int $offset = 0, string $encoding = null ) Parameters mb_strrpos() accepts the following four parameters − $haystack − The string to search in. $needle − ...
Read More