PHP/String/ltrim

Материал из Web эксперт
Перейти к: навигация, поиск

Left padding using the default of spaces

   <source lang="html4strict">

<?php

printf("
Space padding can be tricky in HTML %5d.
", 42);

?>

 </source>
   
  


ltrim() function removes the whitespace and special characters from the left side of string

   <source lang="html4strict">

Its syntax follows: string ltrim (string str) <? print ">".ltrim(" asdf ")."<"; ?>

 </source>
   
  


ltrim() function to strip white space only from the beginning of a string.

   <source lang="html4strict">

<?php $text = "\t\t\tlots of room "; $text = ltrim( $text );

print "
$text
";

?>

 </source>