<?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>Dedy's Personal Site - Web Developer  - PHP Developer - PHP Freelancer &#187; php script</title>
	<atom:link href="http://www.geraiweb.com/wordpress/tag/php-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geraiweb.com/wordpress</link>
	<description>Get to know me.</description>
	<lastBuildDate>Thu, 03 Jun 2010 05:06:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mengubah strange filename ke string</title>
		<link>http://www.geraiweb.com/wordpress/2009/03/04/mengubah-strange-filename-ke-string/</link>
		<comments>http://www.geraiweb.com/wordpress/2009/03/04/mengubah-strange-filename-ke-string/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 09:33:48 +0000</pubDate>
		<dc:creator>dedy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Pemrograman]]></category>
		<category><![CDATA[php script]]></category>

		<guid isPermaLink="false">http://www.geraiweb.com/wordpress/?p=169</guid>
		<description><![CDATA[Ini gw dapet dari php.net waktu gw nyari fungsi u/ mengubah character non alphanumeric ke &#8216;-&#8217; .
Berguna u/ merename filename yg aneh2 atau hal2 lain :


&#60;?&#60;/code&#62;

&#60;code&#62; &#60;/code&#62;

&#60;code&#62;$string = &#34;d&#039;edy adhie&#38;amp;amp;%sdf\&#34;ddd)(*)@#^$*(&#38;amp;amp;)%sfsd.jpg&#34;;

echo &#34;&#60;BR&#62;&#60;BR&#62;&#34;;

echo &#34;string asli : &#34;.$string.&#34;&#60;BR&#62;&#60;BR&#62;&#34;;

echo &#34;sesudah convert : &#34;.string_to_filename($string);

function string_to_filename($word) {

$pos = strrpos($word,&#34;.&#34;);

$ext = substr($word,$pos);

$wordToReplace = substr($word,0,$pos);

&#60;span&#62; &#60;/span&#62;

&#60;span&#62; &#60;/span&#62;// only replace the filename, exclude the [...]]]></description>
			<content:encoded><![CDATA[<p>Ini gw dapet dari php.net waktu gw nyari fungsi u/ mengubah character non alphanumeric ke &#8216;-&#8217; .</p>
<p>Berguna u/ merename filename yg aneh2 atau hal2 lain :</p>
<p><code><span id="more-169"></span></p>
<pre class="brush: php">
&lt;?&lt;/code&gt;

&lt;code&gt; &lt;/code&gt;

&lt;code&gt;$string = &quot;d&#039;edy adhie&amp;amp;amp;%sdf\&quot;ddd)(*)@#^$*(&amp;amp;amp;)%sfsd.jpg&quot;;

echo &quot;&lt;BR&gt;&lt;BR&gt;&quot;;

echo &quot;string asli : &quot;.$string.&quot;&lt;BR&gt;&lt;BR&gt;&quot;;

echo &quot;sesudah convert : &quot;.string_to_filename($string);

function string_to_filename($word) {

$pos = strrpos($word,&quot;.&quot;);

$ext = substr($word,$pos);

$wordToReplace = substr($word,0,$pos);

&lt;span&gt; &lt;/span&gt;

&lt;span&gt; &lt;/span&gt;// only replace the filename, exclude the extension

$tmp = preg_replace(&#039;/\W+|\W+/&#039;, &#039;-&#039;, $wordToReplace); &lt;span&gt; &lt;/span&gt;// remove all non-alphanumeric chars at begin &amp;amp;amp; end of string

$tmp = preg_replace(&#039;/\s+/&#039;, &#039;-&#039;, $tmp); &lt;span&gt; &lt;/span&gt;// compress internal whitespace and replace with _

return strtolower(preg_replace(&#039;/\W-/&#039;, &#039;-&#039;, $tmp)).$ext; &lt;span&gt; &lt;/span&gt;// remove all non-alphanumeric chars except _ and -

}

&lt;/code&gt;

&lt;code&gt;?&gt;
</pre>
<p></code><br />
hasil nya :</p>
<blockquote><p>string asli : d&#8217;edy adhie&amp;%sdf&#8221;ddd)(*)@#^$*(&amp;)%sfsd.jpg</p>
<p>sesudah convert : d-edy-adhie-sdf-ddd-sfsd.jpg</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.geraiweb.com/wordpress/2009/03/04/mengubah-strange-filename-ke-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
