It randomly shuffles a string
Example
<?php
echo str_shuffle(‘phpcode’);
?>
Output
oehppdc
It randomly shuffles a string
Example
<?php
echo str_shuffle(‘phpcode’);
?>
Output
oehppdc
It perform the rot13 transform on a string
Example
<?php
echo str_rot13(‘PHP Code’);
?>
Output
CUC Pbqr
It replace all occurrences of the search string with another string
Example
<?php
echo str_replace(“phpcodez”, “phpcode”, “phpcodez welcomes you”);
?>
Output
phpcode welcomes you
It repeats a string
Example
<?php
echo str_repeat(“php code”, 5);
?>
Output
php codephp codephp codephp codephp code
It pads a string to a certain length with another string
Example
<?php
echo str_pad(“phpcode”,20,”z”);
?>
Output
phpcodezzzzzzzzzzzzz
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