fork(4) download
  1. <?php
  2.  
  3. $s = "acesta este un text";
  4. $sir = "stiu PHP stiu HTML stiu CSS";
  5.  
  6. # inlocuirea unor secvente
  7. print str_replace( "stiu", "invat", $sir); // invat PHP invat HTML invat CSS
  8.  
  9. print "\n";
  10. # schimb tipul literelor (mari, mici)
  11. echo strtoupper( $s ), "\n"; // ACESTA ESTE UN TEXT
  12. echo strtolower( $sir ), "\n"; // stiu php stiu html stiu css
  13. echo ucfirst( $s ), "\n"; // Acesta este un text
  14. echo ucwords( $s ), "\n"; // Acesta Este Un Text
  15.  
  16. print "\n";
  17. # sterg spatiile de la inceput si sfarsit: trim, ltrim, rtrim
  18. print trim(' ok '); // ok
  19.  
  20. print "\n";
  21. # caractere "enter" transformate in <br />
  22. print nl2br( "acesta e afisat pe \n 2 linii" ); // acesta e afisat pe <br /> 2 linii
  23.  
  24. ?>
  25.  
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
invat PHP invat HTML invat CSS
ACESTA ESTE UN TEXT
stiu php stiu html stiu css
Acesta este un text
Acesta Este Un Text

ok
acesta e afisat pe <br />
 2 linii