PHP strnatcasecmp() Function4 Sept 2024 | 1 min read The strnatcasecmp() function is in-built function of PHP. It is used to compare two strings using a "natural order" algorithm. This function accepts two string as parameter and return integer value. It is similar to strnatcmp() function. Note: This function strnatcasecmp() is case-insensitive.Syntax:
Example 1 Output: Your string is: Hello world! Hello world! By using 'strnatcasecmp()' function: 0 Example 2 Output: Your string is: 2Hello world!10Hello WORLD! By using 'strnatcasecmp()' function: -1 Example 3 Output: Your string is: 10Hello world!2Hello WORLD! By using 'strnatcasecmp()' function: 1 See Also
Reference: http://php.net/manual/en/function.strnatcasecmp.php Next TopicPHP String Functions |
PHP string Function The is in-built function of PHP. It is used to return information about words used in a string or counts the number of words in a string. Syntax: str_word_count(string,return,char) Parameter Description Required/Optional string Specify the string to check. Required. return Specify the return value of the function. Values: 0 : It is by default...
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 predefined PHP function. It is used to return parses input from a string according to a format. If we will pass two parameters in the function, the data will be returned as an array. Related Function: print(): It is used for output...
1 min read
PHP string function PHP string is predefined function. It is used to calculate the MD5 hash of a string. It uses the RSA DATA security. It returns the hash as a 32 character hexadecimal number. Note: We should not use this function for secure passwords, due...
1 min read
PHP string Function PHP string is in-built function. It is used to parse the string into variables. Syntax: parse_str(string,array); Parameter Description Required/Optional String Specify the string to parse required Array Specify the name of an array to store the variables. optional Example 1 <?php parse_str("name=John&age=26",$yourArray); print_r($yourArray); ?> Output: Array ( [name] => John [age] => 26 ) Example 2 <?php parse_str("name=John&age=26"); echo "Your Name:".$name."<br>"; echo "Your Age:".$age; ?> Output: Your Name:John Your...
1 min read
PHP string md5_file() Function PHP string md5_file() function is in-built important function. It is used to calculate the MD5 hash of a file. It uses the RSA Data Security. It returns the md5 hash on success, or FALSE on failure. Syntax: md5_file(file,raw); Parameter Description Required/Optional File Specify the file to be calculated. Required Raw Specify the Boolean...
1 min read
PHP String function The is an in-built function of PHP which writes a formatted string to a variable. It returns a formatted string. PHP 4 and above versions support function. The function is similar to the printf() function, but the only difference between both...
5 min read
PHP Function PHP function is string function, which is used to convert character to HTML entities. Syntax: htmlentities(string,flags,character-set,double_encode); Parameter Description Required/Optional String Specify the string to convert. required flags Specify how to manage quotes, invalid encoding. optional Character Specify the character set optional Double_encode Specify a Boolean value. optional Example 1 <?php $str = '<a href="https://www.javatpoint.com">Go to javatpoint.com</a>'; echo htmlentities($str); ?> Output: Go to javatpoint.com Example 2 <?php $str = "Hello PHP...
1 min read
PHP string function The is an in-built function of PHP, which is used to add a backslash before some meta characters in the string. It returns the string by adding the backslash before every meta characters. It avoids SQL injections attacks of our database. The...
2 min read
PHP string function PHP string is predefine function. It is used to compare two given string. It is binary safe and case-insensitive. It is similar to the strncasecmp() function. It returns: If the two strings are equal: [ 0 ] If string1 is less than string2: [<...
1 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