It make a string’s first character uppercase
Example
<?php
echo ucfirst(“phpcode”);
?>
Output
Phpcode
It make a string’s first character uppercase
Example
<?php
echo ucfirst(“phpcode”);
?>
Output
Phpcode
It strips whitespace from the beginning and end of a string
Example
<?php
echo trim(” php code “);
?>
Output
php code
It returns part of a string
Example
<?php
echo substr(“phpcode”,2,4);
?>
Output
pcod
It replace text within a portion of a string
Example
<?php
echo substr_replace(“php code”,”codez”,4);
?>
Output
php codez
It counts the number of substring occurrences
Example
<?php
echo substr_count(“phpcode. phpcodez”,”code”);
?>
Output
2
It compares two strings from a specified start position
Example
<?php
echo substr_compare(“phpcodexc”,”phpcode”,0);
?>
Output
2
It translate characters or replace substrings
Example
<?php
echo strtr(“One Two”,array(“One” => “PHP”, “Two” => “HTML”));
?>
Output
PHP HTML
It makes a string uppercase
Example
<?php
echo strtoupper(“PHPCode”);
?>
Output
PHPCODE
It makes a string lowercase
Example
<?php
echo strtolower(“PHPCode”);
?>
Output
phpcode
It splits a string into smaller strings
Example
<?php
$tokenVal = strtok(“php html js”, ” “);
while ($tokenVal != false) {
echo $tokenVal .” “;
$tokenVal =strtok(” “);
}
?>
Output
php html js