<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Commenti a: Very short snippet: PHP word cut</title>
	<atom:link href="http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/</link>
	<description>Research &#38; Development  Blog</description>
	<lastBuildDate>Fri, 12 Mar 2010 15:50:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Di: Undolog.com&#187; Very short snippet: PHP, tagliare a parole, contanto i caratteri</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-2447</link>
		<dc:creator>Undolog.com&#187; Very short snippet: PHP, tagliare a parole, contanto i caratteri</dc:creator>
		<pubDate>Sat, 12 Sep 2009 22:36:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-2447</guid>
		<description>[...] già visto in Very short snippet: PHP word cut è più gradevole spezzare un testo a &quot;parole&quot;, in quanto si evita di tagliare una parola. C&#039;è [...]</description>
		<content:encoded><![CDATA[<p>[...] già visto in Very short snippet: PHP word cut è più gradevole spezzare un testo a &quot;parole&quot;, in quanto si evita di tagliare una parola. C&#39;è [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Badoux C.</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1183</link>
		<dc:creator>Badoux C.</dc:creator>
		<pubDate>Tue, 07 Oct 2008 17:03:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1183</guid>
		<description>Je n&#039;en dirai pas plus:

http://fr.php.net/manual/fr/function.substr.php

et pour finir un exemple:

http://www.destrucsaweb.com/ressources/phpmyannu/goto_38.php

A+</description>
		<content:encoded><![CDATA[<p>Je n&#8217;en dirai pas plus:</p>
<p><a href="http://fr.php.net/manual/fr/function.substr.php" rel="nofollow">http://fr.php.net/manual/fr/function.substr.php</a></p>
<p>et pour finir un exemple:</p>
<p><a href="http://www.destrucsaweb.com/ressources/phpmyannu/goto_38.php" rel="nofollow">http://www.destrucsaweb.com/ressources/phpmyannu/goto_38.php</a></p>
<p>A+</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Giovambattista Fazioli</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1140</link>
		<dc:creator>Giovambattista Fazioli</dc:creator>
		<pubDate>Mon, 22 Sep 2008 12:32:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1140</guid>
		<description>@Giulio: prego caro! Anche se nessuno si è accorto che per grandi stringhe la funzione corretta sarebbe:
[php]
function wordCut($c, $l){
    $a= explode(&#039; &#039;,$c);
    if( count($a) &gt; $l) {
        for($i=0; $i&lt;$l; $i++) $r[$i] = $a[$i];
        $r= implode(&#039; &#039;, $r).&#039;...&#039;;
        return $r;
    } else return $c;
}
[/php]
:P</description>
		<content:encoded><![CDATA[<p>@Giulio: prego caro! Anche se nessuno si è accorto che per grandi stringhe la funzione corretta sarebbe:</p>
<div class="igBar"><span id="lphp-1"><a href="#" onclick="javascript:showCodeTxt('php-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-1">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> wordCut<span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$a</span><span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$l</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$r</span><span style="color: #339933;">=</span> <a href="http://www.php.net/implode"><span style="color: #990000;">implode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$r</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$c</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
 <img src='http://www.undolog.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Giovambattista Fazioli</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1139</link>
		<dc:creator>Giovambattista Fazioli</dc:creator>
		<pubDate>Mon, 22 Sep 2008 12:29:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1139</guid>
		<description>@Napolux: ho cercato invano la tua funzione sul tuo blog... cmq anche così andrebbe bene:
[php]
function wordCut($c, $l){
    $c = explode(&#039; &#039;,$c);
    for($i=0; $i&lt;$l; $i++) $r[$i] = ($i==0)?$c[$i]:(&#039; &#039;.$c[$i]);
    return ($r.&#039;...&#039;);
}
[/php]
Nota la &quot;chicca&quot; per non preoccuparsi di eliminare lo spazio in più :)</description>
		<content:encoded><![CDATA[<p>@Napolux: ho cercato invano la tua funzione sul tuo blog... cmq anche così andrebbe bene:</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showCodeTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000000; font-weight: bold;">function</span> wordCut<span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$l</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">==</span>0<span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#FF9900;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'...'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Nota la "chicca" per non preoccuparsi di eliminare lo spazio in più <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Giovambattista Fazioli</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1138</link>
		<dc:creator>Giovambattista Fazioli</dc:creator>
		<pubDate>Mon, 22 Sep 2008 12:12:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1138</guid>
		<description>@Tom: oddio, un esempio per una funzione &quot;taglia stringhe&quot; è un po&#039; eccessivo... :) Tuttavia, ad esempio, la puoi usare per:
[php]
$res = wordCut( &#039;Stringa di esempio abbastanza lunga per essere tagliata&#039;, 5 );
[/php]
Otterai in &lt;code&gt;$res&lt;/code&gt;:
&lt;pre&gt;Stringa di esempio abbastanza lunga...&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Tom: oddio, un esempio per una funzione "taglia stringhe" è un po' eccessivo... <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Tuttavia, ad esempio, la puoi usare per:</p>
<div class="igBar"><span id="lphp-3"><a href="#" onclick="javascript:showCodeTxt('php-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-3">
<div class="php" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#758DB8;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> wordCut<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Stringa di esempio abbastanza lunga per essere tagliata'</span><span style="color: #339933;">,</span> 5 <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
Otterai in <code>$res</code>:</p>
<pre>Stringa di esempio abbastanza lunga...</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Napolux</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1136</link>
		<dc:creator>Napolux</dc:creator>
		<pubDate>Mon, 22 Sep 2008 11:06:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1136</guid>
		<description>LOL!</description>
		<content:encoded><![CDATA[<p>LOL!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Giulio</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1135</link>
		<dc:creator>Giulio</dc:creator>
		<pubDate>Mon, 22 Sep 2008 11:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1135</guid>
		<description>Grazie! Carpita e usata...</description>
		<content:encoded><![CDATA[<p>Grazie! Carpita e usata...</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Napolux</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1127</link>
		<dc:creator>Napolux</dc:creator>
		<pubDate>Sun, 21 Sep 2008 20:55:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1127</guid>
		<description>La mia tagliaStringa($stringa,$numParole) è un po&#039; diversa... Non uso due array, ma costruisco la stringa inserendo le parole man mano in una variabile, tagliando poi l&#039;ultimo spazio e aggiungendo i tre puntini...

Che dici?</description>
		<content:encoded><![CDATA[<p>La mia tagliaStringa($stringa,$numParole) è un po' diversa... Non uso due array, ma costruisco la stringa inserendo le parole man mano in una variabile, tagliando poi l'ultimo spazio e aggiungendo i tre puntini...</p>
<p>Che dici?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Di: Tom</title>
		<link>http://www.undolog.com/2008/09/21/very-short-snippet-php-word-cut/comment-page-1/#comment-1126</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Sun, 21 Sep 2008 17:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.undolog.com/?p=677#comment-1126</guid>
		<description>Dai 2 righe per un esempiuccio potevate farle. :)</description>
		<content:encoded><![CDATA[<p>Dai 2 righe per un esempiuccio potevate farle. <img src='http://www.undolog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
