It replaces some characters in a string (case-insensitive)
Example
<?php
echo str_ireplace(“phpcodez”, “phpcode”, “phpcodez”);
?>
Output
phpcode
It replaces some characters in a string (case-insensitive)
Example
<?php
echo str_ireplace(“phpcodez”, “phpcode”, “phpcodez”);
?>
Output
phpcode
It parse a CSV string into an array
Example
<?php
echo “<pre>”;
print_r(str_getcsv(“php,code”));
?>
Output
fiArray
(
[0] => php
[1] => code
)
It parses input from a string according to a format
Example
<?php
$string = “first:php second:code”;
sscanf($string,”%s%s”,$first,$second);
echo $first.$second;
?>
Output
first:phpsecond:code
It returns a formatted string
Example
<?php
parse_str(“first=php&second=code”);
echo sprintf(“%s%s”,$first,$second);
?>
Output
phpcode
It calculates the soundex key of a string
Example
<?php
echo soundex(“phpcode”);
?>
Output
P123
It calculates the similarity between two strings
Example
<?php
echo similar_text(“phpcode”,”phpcodez”);
?>
Output
7
It calculates the SHA-1 hash of a file
Example
<?php
echo sha1(“phpcode”);
?>
Output
1786808aabe8b4f824ef2741a9e63bf8212e52d3
It calculates the SHA-1 hash of a file
Example
<?php
echo sha1_file(“test.txt”);
?>
Output
1786808aabe8b4f824ef2741a9e63bf8212e52d3
It sets locale information
Example
<?php
echo setlocale(LC_ALL,”En-Us”);
?>
It strips whitespace from the end of a string
Example
<?php
echo rtrim(“phpcode “);
?>
Output
phpcode