|
ltrim
Strip whitespace (or other characters) from the beginning of a string
(PHP 4, PHP 5)
Example 2419. Usage example of ltrim()<?php The above example will output: string(32) " These are a few words :) ... " Related Examples ( Source code ) » ltrim Examples ( Source code ) » Trimming Strings Examples ( Source code ) » Trimming Strings Examples ( Source code ) » Trimming Strings Examples ( Source code ) » Trimming Strings for 'tab' and 'return' Examples ( Source code ) » String trim chop and length Code Examples / Notes » ltrimjohn sherwood
To remove leading/trailing zeroes (example: "0123.4560"), doing a += 0 is easier than trim tricks.
jan
if you have a numer like 0310, don't use this code: $number = '0310'; $number = ltrim( $number, "\0x30" ); echo $number; output: 10 for a correct output use: $number = '0310'; $number = ltrim( $number, "0" ); echo $number; output: 310 the "\0x30" works only with the first 32 ascii characters draugluin izzat bigfoot dizzot com
A fast way to get a file extension: $ext = ltrim(strrchr($filename,'.'),'.'); |
Change Languageaddcslashes addslashes bin2hex chop chr chunk_split convert_cyr_string convert_uudecode convert_uuencode count_chars crc32 crypt echo explode fprintf get_html_translation_table hebrev hebrevc html_entity_decode htmlentities htmlspecialchars_decode htmlspecialchars implode join levenshtein localeconv ltrim md5_file md5 metaphone money_format nl_langinfo nl2br number_format ord parse_str printf quoted_printable_decode quotemeta rtrim setlocale sha1_file sha1 similar_text soundex sprintf sscanf str_getcsv str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count strcasecmp strchr strcmp strcoll strcspn strip_tags stripcslashes stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strrchr strrev strripos strrpos strspn strstr strtok strtolower strtoupper strtr substr_compare substr_count substr_replace substr trim ucfirst ucwords vfprintf vprintf vsprintf wordwrap |