
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1060 Articles for PHP

2K+ Views
In PHP, mb_substr() is used to return the selected part of a given string. The multibyte safe substr() works based on the number of characters. It counts the position from the starting of the string. It will return 0 for the first character position and 1 for the second position character, and so on.Syntaxstring mb_substr(str $string, int $start, int $length, str $encoding)ParametersThis PHP function accepts four parameters: $string, $start, $length and $encoding.$string− This parameter is used to extract the substring from the given string.$string = mb_substr("Welcome to the online tutorials!", 5, 10, "UTF-8");$start− This parameter returns 0 for the first ... Read More

487 Views
mb_convert_case() is an inbuilt function in PHP that is used to perform case folding on a given string.Syntaxstring mb_convert_case(str $string, int $mode, str $encoding)Parametersmb_convert_case() accepts three parameters: $string, $mode and $encoding to perform case folding on a string.$string− This parameter is used to return the string being converted.$mode: The mode parameter is used for the mode of the conversion. It can be used for multibyte string conversion for MB_CASE_UPPER, MB_CASE_LOWER, MB_CASE_TITLE, MB_CASE_FOLD, MB_CASE_UPPER_SIMPLE, MB_CASE_LOWER_SIMPLE, MB_CASE_TITLE_SIMPLE, MB_CASE_FOLD_SIMPLE.$encoding: This parameter is the character encoding. If it is omitted or null, then the internal character encoding value will be usedReturn Valuesmb_convert_case() is used to return ... Read More

825 Views
In PHP, the mb_chr() function is used to return character by Unicode code point value. This function returns a string having the character identified by the Unicode code point value, encoded in the specified encoding.Syntaxstring mb_chr(int $codepoint, string $encoding)Parametersmb_chr() accepts only two parameters: $codepoint and $encoding.$codepoint− This parameter is used to convert a Unicode codepoint value. For example, 128024 for U+1F418 ELEPHANT.$encoding− This parameter is the character encoding. If it is absent or null, then the internal character encoding value will be used.Return ValuesThis function returns a string containing the requested character if it can be represented in the specified encoding ... Read More

938 Views
In PHP, the mb_check_encoding() function is used to check if the given strings are valid for the specified encoding. This function checks if the specified byte stream is valid for the specified encoding.Syntaxbool mb_check_encoding(str $value=null, str $encoding=null)Note: The function will check if the stated byte stream is valid for the stated encoding. And if the given value is an array type, then all the keys and values will validate recursively. It avoids the invalid encoding attack.Parametersmb_check_encoding() accepts two parameters: $value and $encoding.$value− It is used to check the byte stream or array if it is omitted and it checks all ... Read More

1K+ Views
In PHP, the iconv() function is used to convert a string to the requested character encoding. It is used to perform a character set conversion on the string "string" from from_encoding to to_encoding.Syntaxstring iconv(str $from_encoding, str $to_encoding, str $string)ParametersThe iconv() function accepts three parameters: $from_encoding, $to_encoding and $string.$from_encoding− This parameter is used to specify the input charset.$to_encoding− This parameter is used for the output charset.$string− This parameter is used to convert the string.Return Valuesiconv() returns the converted string on success or it returns False on failure.Example Live Demo OutputOriginal:the Dollar symbol '$' TRANSLIT: the Dollar symbol '$' IGNORE: the Dollar symbol ... Read More

260 Views
In PHP, the iconv_substr() function is used to cut a portion of a specified string by the offset and length parameters. Suppose we have a string "helloWorld" and we want to cut and show only the string (llowo), then we will select it by using numbers from 2 to 5.Syntaxstring iconv_substr(str $string, int $offset, int $length, str $encoding)Parametersiconv_substr() accepts four parameters: $string, $offset, $length and $encoding.$string− The $string parameter specifies the original string.$offset− If the $offset parameter is non-negative, then the iconv_substr() function cuts the selected portion of the string from beginning at offset character, counting from zero. And if ... Read More

258 Views
In PHP, the iconv_strrpos() function is used to findsthe last occurrence of a needle within a haystack. Or, we can say that the iconv_strrpos() function returns the last character number from the haystack.Syntaxstring iconv_strrpos(string $haystack, str $needle, str $encoding)Parametersiconv_strrpos() accepts three parameters: $haystack, $needle and $encoding.$haystack− It denotes the whole string.$needle− The $needle parameter is used to search the substring from the given whole string.$encoding− if the $encoding parameter is absent or null, then the string will assume that it may be encoded in iconv.internal_encoding.Return Valuesiconv_strpos() returns the numeric position of the given first occurrence of the needle from the ... Read More

466 Views
In PHP, the iconv_strpos() function is used to read the first character from a given string. It finds the position of the first occurrence of a character in a string. It is an inbuilt function in PHP.Syntaxstring iconv_strpos(string $haystack, string $needle, int $offset, string $encoding)Note: strpos(), the return value of iconv_strpos() is the number of characters that appear before the needle, rather than the offset in bytes to the position where the needle has been found. The characters are counted based on the specified character set encoding.Parametersiconv_strpos() function accepts four different parameters− $haystack, $needle, $offset and $encoding.$haystack− It denotes the ... Read More

346 Views
In PHP, the iconv_strlen() function is used to return the character count of a given string. This is an inbuilt function in PHP that is first used in PHP 5 version. Encoding is nullable from PHP 8.0.Syntaxstring iconv_strlen(str $string, str $encoding)ParametersThis PHP function accepts two parameters: $string and $encoding.$string− The $string parameter is used for the input string.$encoding− If the $encoding parameter is absent or it is null, then the string is assumed to be encoded in iconv.internal_encoding.Return ValuesThe iconv_strlen() function returns the list of characters count which is present in the given string, or it returns False if an error ... Read More

269 Views
In PHP, the iconv_set_encoding() function is used to set the current character encoding conversion. It is an inbuilt function in PHP that changes the value of the internal configuration variable specified by type to encoding.Syntaxstring iconv_set_encoding(string $type, string $encoding)Parametersiconv_set_encoding() takes two parameters − $type and $encoding.$type − The $type parameter can be input_encoding, output_encoding or internal_encoding.$encoding − The $encoding parameter is used for the character set.Return Valuesiconv_set_encoding() returns True on success and False on failure.Example Live Demo Outputarray(3) { ["input_encoding"]=> string(5) "UTF-8" ["output_encoding"]=> string(5) "UTF-8" ["internal_encoding"]=> string(5) "UTF-8" }Read More