<?php

$s = "acesta este un text";
$sir = "stiu PHP stiu HTML stiu CSS";

# inlocuirea unor secvente
print str_replace( "stiu", "invat", $sir); // invat PHP invat HTML invat CSS
 
print "\n";
# schimb tipul literelor (mari, mici)
echo strtoupper( $s ), "\n"; // ACESTA ESTE UN TEXT
echo strtolower( $sir ), "\n"; // stiu php stiu html stiu css
echo ucfirst( $s ), "\n"; // Acesta este un text
echo ucwords( $s ), "\n"; // Acesta Este Un Text
 
print "\n";
# sterg spatiile de la inceput si sfarsit: trim, ltrim, rtrim
print trim('      ok        '); // ok
 
print "\n";
# caractere "enter" transformate in <br />
print nl2br( "acesta e afisat pe \n 2 linii" ); // acesta e afisat pe <br /> 2 linii

?>
