PHP strnatcmp() Function4 Sept 2024 | 1 min read The strnatcmp() function in-built string function of PHP. It is used to compare string by using a natural algorithm. Syntax:
This function strnatcmp():
Note: It is case sensitive.Example 1Output: By Using strnatcmp()Function:-1 Example 2Output: By Using strnatcmp()Function:1 Example 3Output: Standard string comparisonnArray ( [0] => PHP1 [1] => PHP10 [2] => PHP12 [3] => PHP2 ) nNatural order string comparisonnArray ( [0] => PHP1 [1] => PHP2 [2] => PHP10 [3] => PHP12 ) See Also:
Reference: http://php.net/manual/en/function.strncmp.php Next TopicPHP String |
PHP Function PHP function is used to convert string value of ASSCII characters to hexadecimal value. Syntax: string bin2hex ( string $str ) Parameter Description Required/Optional string The string to be converted Required Example 1 <?php $str ="Hello World!"; echo "Your ASCII character is: ".$str; echo "<br>"."By using '' Method your hexadecimal value is: ".bin2hex($str); ?> Output: Your ASCII...
1 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 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 String function The is one of the most popular functions of PHP, which is widely used to convert the string into uppercase. It takes a string as a parameter and converts all lowercase English character of that string to uppercase. Other characters such as...
2 min read
PHP string Function The is predefine function of PHP. It is used to repeat a string a specified number times. It returns input repeated multiple times. Syntax: tr_repeat(string,repeat); Parameter Description Required/Optional String Specify the string to repeat. Required repeat Specify the number of times for repeated. required Example 1 <?php echo "Before using '' function: ('.',13)"; echo "<br>"; echo "After using...
1 min read
PHP Function The function in inbuilt function of PHP. It is used to find the position of the last occurrence of a string. This function returns all characters from this position to the end of the string or FALSE if the character is not found. Note: The...
1 min read
PHP String Function The is a built-in function of PHP, which helps to compare the two strings from a specified start position to specified end position. This function is a binary-safe function and optionally case-sensitive. PHP 5 and above versions support this function. Syntax The syntax of...
3 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 an in-built string function of PHP. It is used to display the array values as a formatted string according to the format. The main purpose of this function is to display a formatted string. PHP 4 and above versions supports...
3 min read
PHP string join() Function PHP string join() is predefined function. It is used to return a string from the elements of an array. It is an alias of the implode() function. Syntax: join(separator,array) Parameter Description Required/Optional separator Specify the array element optional array The array to join to a string required Example 1 <?php $arr = array('Hello','PHP','Join','Function'); echo join(" ",$arr)."<br>"; ?> Output: Hello PHP Join...
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