<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewSourceMedia Blog &#187; rtrim</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/rtrim/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Mon, 07 May 2012 01:26:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP strip remove white space from end of string</title>
		<link>http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/</link>
		<comments>http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/#comments</comments>
		<pubDate>Sat, 27 Mar 2004 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[String Manipulation]]></category>
		<category><![CDATA[rtrim]]></category>
		<category><![CDATA[shorten]]></category>
		<category><![CDATA[strip]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[whitespace]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/2004/03/26/php-strip-remove-white-space-from-end-of-string/</guid>
		<description><![CDATA[Need to remove the white space at the end of a string before recording the data. Use PHP's rtrim(). rtrim(): rtrim is great for deleting that unwanted space at then end of strings. The perfect example for using this function &#8230; <a href="http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Need to remove the white space at the end of a string before recording the data. Use PHP's rtrim().
<span id="more-204"></span>
rtrim():

rtrim is great for deleting that unwanted space at then end of strings. The perfect example for using this function is when receiving data from an online form and, at the end of a data field, some one leaves an extra white space. This white space means nothing and you want to delete it. rtrim() to the rescue.

Example:

<pre lang="php">
<?
$password = "123 ";
$password = rtrim($password);
// $password = "123"
?>
</pre>

Other Examples:

You can also trim down a string by matching words or letters and the end of a string.

Example:
<pre lang="php">
// Example 1: Character-by-character comparison match.

echo rtrim('This is a test test code', 'test code');
// returns 'This is a'

// Example 2: matches the last whole word with half the letters

echo rtrim('This is a test', 'est');
// returns 'This is a'
?> 
</pre>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-strip-remove-white-space-from-end-of-string/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
