PHP string sha1_file() Function4 Sept 2024 | 1 min read The sha1_file() function is predefined PHP string function. It is used to calculate the SHA-1 hash of a file. It uses he US secure Hash Algorithm 1 and calculate the ha1 hash US secure Hash Algorithm 1. The hash is a 40 character hexadecimal number. It returns the calculated SHA-1 hash on success or False on failure. Syntax:
Example 1Save it: "test.txt" Save it: test.php Output: Your filename is:test.txt By using sha1_file() function:a02e266c6f3a8ff0c4250e502828c4ebf179d252 Example 2Save it: "test.txt" Save it: "sha1file.txt" Save it: "index.php" Save it: "test.php " Output: The file is ok. Note: If "test.txt" has been changed (that is if the SHA-1 hash has been changed):Next TopicPHP String |
function in PHP The is a case-insensitive, built-in function of PHP. It compares two strings for the first n characters. This function is similar to the strcasecmp() function with a difference. In , we can specify the number of characters from both the strings for...
3 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 Function PHP string is predefined function. It is used to replace some character with some other characters. It is case-insensitive version of str_replace(). Note: This function is binary-safe. Syntax: str_ireplace(find,replace,string,count); Parameter Description Required/Optional find Specify the value to find. Required replace Specify the value to replace. Required string Specify the string to be searched Required Count It is variable that...
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 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
PHP explode() is a string function, which splits a string by a string. In simple words, we can say that it breaks a string into an array. The explode() function has a "separator" parameter, which cannot contain an empty string, because it holds the original...
3 min read
PHP String Function The function is the in-built function of PHP. It is used to get numeric information. This function returns an array which contains local numeric and monetary formatting information. This function is a non-parameterized function, so we do not need to pass anything...
5 min read
PHP String Function The function is an in-built function of PHP, which is used to display the array values as a formatted string. It works similar to the sprintf() function, but it accepts an array of arguments rather a variable number of arguments. PHP 4.1.0...
2 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
PHP string Function PHP is predefined function which is used to remove whitespace or character form the right side of a string. Syntax: rtrim(string,charlist); Parameter Description Required/Optional string Specify the string to check. required charlist Specify character to remove Following character "\0" - NULL "\t" - tab "\n" - new line "\x0B" - vertical tab "\r" - carriage return " "...
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