<?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>SanBaldo - blog personale sulla tecnologia e sugli acquisti online &#187; php</title>
	<atom:link href="http://www.sanbaldo.com/wordpress/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sanbaldo.com/wordpress</link>
	<description>tutta un'altra religione</description>
	<lastBuildDate>Wed, 29 Sep 2010 12:07:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Forzare i leading zero su un numero o una stringa in PHP</title>
		<link>http://www.sanbaldo.com/wordpress/code/forzare-i-leading-zero-su-un-numero-o-una-stringa-in-php/</link>
		<comments>http://www.sanbaldo.com/wordpress/code/forzare-i-leading-zero-su-un-numero-o-una-stringa-in-php/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 11:00:54 +0000</pubDate>
		<dc:creator>Baldo</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[examples code]]></category>
		<category><![CDATA[language php]]></category>
		<category><![CDATA[leading zero]]></category>
		<category><![CDATA[string lenght]]></category>

	<!-- AutoMeta Start -->
	<category>topsajaxadmin2wefwf</category>
	<category>flickr</category>
	<category>sanbaldo</category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.sanbaldo.com/wordpress/?p=838</guid>
		<description><![CDATA[<div class="image"><img src="http://www.sanbaldo.com/wordpress/wp-content/uploads/2009/01/php.gif" /></div>
Per esempio se volete che la vostra stringa sia di 10 caratteri e che i caratteri aggiuntivi siano degli zero, potreste usare questo codice:

<code>$valore = str_pad($valore, 10, 0);</code>

che sfrutta questa funzione php:

<code>string str_pad  ( string $input  , int $pad_length  [, string $pad_string  [, int $pad_type  ]] )</code>

<em>This functions returns the input  string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string  is not supplied, the input  is padded with spaces, otherwise it is padded with characters from pad_string  up to the limit.</em>

Che in pratica vuol dire:
La fuzione restituisce la stringa "$input" <em>allungata </em>a destra, a sinistra o da entrambi i lati fino ad arrivare alla lunghezza definita ($pad_lenght). Se non è definito il parametro $pad_string, la stringa viene allungata per mezzo di spazi.]]></description>
			<content:encoded><![CDATA[<div class="image"><img src="http://www.sanbaldo.com/wordpress/wp-content/uploads/2009/01/php.gif" /></div>
<p>Per esempio se volete che la vostra stringa sia di 10 caratteri e che i caratteri aggiuntivi siano degli zero, potreste usare questo codice:</p>
<p><code>$valore = str_pad($valore, 10, 0);</code></p>
<p>che sfrutta questa funzione php:</p>
<p><code>string str_pad  ( string $input  , int $pad_length  [, string $pad_string  [, int $pad_type  ]] )</code></p>
<p><em>This functions returns the input  string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string  is not supplied, the input  is padded with spaces, otherwise it is padded with characters from pad_string  up to the limit.</em></p>
<p>Che in pratica vuol dire:<br />
La fuzione restituisce la stringa &#8220;$input&#8221; <em>allungata </em>a destra, a sinistra o da entrambi i lati fino ad arrivare alla lunghezza definita ($pad_lenght). Se non è definito il parametro $pad_string, la stringa viene allungata per mezzo di spazi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sanbaldo.com/wordpress/code/forzare-i-leading-zero-su-un-numero-o-una-stringa-in-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

