PHP string ord() Function4 Sept 2024 | 1 min read PHP string ord() is predefined function. It is used to convert first byte of string to a value between 0 and 255. It returns ASCII value. Syntax:
Example 1Output: Your Value is: P By using 'ord()' Function:80 Example 2Output: Your Value is: PHP By using 'ord()' Function:80 Note: This function returns the ASCII value of the first character of a string.Example 3Output: Converted ASCII VALUE 48 49 50 51 52 53 Next TopicPHP String |
PHP function PHP is most important string function. It is used to return information about characters in a string. Syntax: count_chars(string,mode); Parameter Description Required/Optional string The string to be checked Required mode Specify the return modes Optional Note: Depending on mode '' function returns one of the following: 0 : It is an array with the byte-value as key...
2 min read
PHP Function The function is predefined function of PHP. It is used to find the length of string or returns the length of a string including all the whitespaces and special character. Syntax: strlen(string); Parameter Description Required/Optional String Specify the string to check. Required. Example 1 <?php $str = 'Javatpoint'; echo "Your String is:".$str; echo "<br>"; echo "By using...
1 min read
PHP Function PHP function is used to add quote string with slashes in a C style. It is case-sensitive Syntax: string addcslashes ( string $str , string $charlist ) Parameter Description Required/Optional String String to be esxaped Required Character Character or range to be escaped. Required Example 1 <?php $str="Welcome to JavaTpoint"; echo "Your String : ".$str; echo "<br>"."By using ''...
1 min read
PHP string levenshtein() Function PHP string levenshtein() function is in-built function. It is used to calculate the distance between two strings. By default, PHP provides some operations (replace, insert and delete) It returns the Levenshtein distance between the two argument strings or -1, if the string exceeds 255...
1 min read
PHP Function The is predefine function of PHP. It is used to find the position of the first occurrence of a string inside another string. Note: This function is case-insensitive and binary safe. Syntax: stripos(string,find,start); Parameter Description Required/Optional string Specify the string to search. Required. find Specify he string to find. Required. start Specify where to begin the search. Optional. Example...
1 min read
PHP Function PHP function is used to convert a string hexadecimal value to ASCII ccharacters. Note: This function does not convert a hexadecimal number to a binary number. Syntax: string hex2bin ( string $data ) Parameter Description Required/Optional String Specify the hexadecimal value to be converted. required Example 1 <?php echo hex2bin("48656c6c6f20576f726c6421"); ?> Output: Hello World! Example 2 <?php $hex = hex2bin("6578616d706c65206865782064617461"); var_dump($hex); ?> Output: string(16) "example...
1 min read
PHP String Function The is a built-in function of PHP, which is used to extract a part of a string. The function returns a part of a string specified by the start and length parameter. PHP 4 and above versions support this function. Syntax The syntax...
3 min read
PHP Function The PHP function is used to generate a single byte string from a number. In another words we can say that it returns a character from specified ASCII value. Syntax: string chr ( int $bytevalue ); Parameter Description Required/Optional ascii An ASCII value Required Example 1 <?php $char =52; echo "Your character is :".$char; echo...
1 min read
PHP Function PHP function is important string function, which is used to calculate the crc32( cyclic redundancy checksum ) polynomial of a string. It can be used to validate data integrity. Note : you are using function then, you must have to use %u formatter...
1 min read
PHP str_replace() function The str_replace() function is a case-sensitive, built-in function of PHP which replaces some character of the string with other characters. It is used to replace all the occurrences of the search string with the replacement string. Syntax The syntax of the str_replace() function is given below,...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India