★ wanayoo — archive 1999 http://php.net/manual/it/function.trim.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Strings
Quick Reference
Strings
English version of this pageGerman version of this pageJapanese version of this page
Italian version of this pageFrench version of this pageHungarian version of this page
Spanish version of this page
* AddCSlashes
* AddSlashes
* bin2hex
* Chop
* Chr
* chunk_split
* convert_cyr_string
* count_chars
* crc32
* crypt
* echo
* explode
* get_html_translation_table
* get_meta_tags
* hebrev
* hebrevc
* htmlentities
* htmlspecialchars
* implode
* join
* levenshtein
* ltrim
* md5
* Metaphone
* nl2br
* Ord
* parse_str
* print
* printf
* quoted_printable_decode
* quotemeta
* rtrim
* sscanf
* setlocale
* similar_text
* soundex
* sprintf
* strcasecmp
* strchr
* strcmp
* strcspn
* strip_tags
* stripcslashes
* stripslashes
* stristr
* strlen
* strnatcmp
* strnatcasecmp
* strncmp
* str_pad
* strpos
* strrchr
* str_repeat
* strrev
* strrpos
* strspn
* strstr
* strtok
* strtolower
* strtoupper
* str_replace
* strtr
* substr
* substr_count
* substr_replace
* trim
* ucfirst
* ucwords
* wordwrap

  Thanks to:
 Chek.com
 easyDNS
 VA Linux Systems

  Related sites:
Apache
MySQL
PostgreSQL
Zend Tech.

  Community:
LinuxFund.org
OSDN
Manual: trim
View the source code for this pageSearch the site



Previous page
 substr_replace
 Updated
Mon, 18 Sep 2000
ucfirst 
Next page


trim

(PHP3 <= 3.0.16, PHP4 )

trim --  Strip whitespace from the beginning and end of a string

Description

string trim (string str)

This function strips whitespace from the start and the end of a string and returns the stripped string. The whitespace characters it currently strips are: "\n", "\r", "\t", "\v", "\0", and a plain space.

See also chop(), rtrim() and ltrim().


User Contributed Notes: trim


brez@jordanchans.com
05-Jan-2000 11:40
It trims ALL leading and trailing spaces, one solution to the problem with explode()include spaces in the
array.



webmaster@nnytech.net
06-Jul-2000 12:45
An example

<?php
$stri = "\nThis string has \ whitespace\n\n\n";
echo trim($stri);
?>

Hope that helps..



alivesay@yellowbrix.com
24-Jul-2000 06:35
If you are trying to take out whitespace from the middle of a string, you need to use a different function, str_replace:

<PRE>str_replace(" ", "", "United Kingdom);</PRE>



pgl@instinct.org
11-Sep-2000 11:43
see also rtrim


 About Notes


Previous page
 substr_replace
 Updated
Mon, 18 Sep 2000
ucfirst 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.