<?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>MafiaGeek &#187; PHP</title>
	<atom:link href="http://www.mafiageek.com/index.php/archives/category/programming/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mafiageek.com</link>
	<description></description>
	<lastBuildDate>Tue, 05 Jul 2011 19:55:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Language</title>
		<link>http://www.mafiageek.com/index.php/archives/230</link>
		<comments>http://www.mafiageek.com/index.php/archives/230#comments</comments>
		<pubDate>Sun, 05 Sep 2010 13:27:06 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=230</guid>
		<description><![CDATA[I&#8217;ve been working with PHP a lot as of late. I feel that PHP  just does not cut it when it come to developing web 2.0 web applications. Also i do not like where php is going syntactically. ?Download language.lang1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with PHP a lot as of late. I feel that PHP  just does not cut it when it come to developing web 2.0 web applications. Also i do not like where php is going syntactically.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.mafiageek.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=230&amp;download=language.lang">language.lang</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2302"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p230code2"><pre class="text" style="font-family:monospace;">&lt;%
namespace Website{
   class Application{
      public Application(){
        write(&quot;Hello World\n&quot;);
      }
&nbsp;
      public name(){
        write exists(Server.get.name) ? Server.get.name : &quot;No name supplied&quot;;
      }
   }
}
&nbsp;
application = new Website::Application();
application.name();
&nbsp;
%&gt;</pre></td></tr></table></div>

<p>Above is style of syntax i like. The closest language would be c#.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/230/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing blank lines with a regular expression.</title>
		<link>http://www.mafiageek.com/index.php/archives/206</link>
		<comments>http://www.mafiageek.com/index.php/archives/206#comments</comments>
		<pubDate>Mon, 23 Nov 2009 10:29:46 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Regular expression]]></category>
		<category><![CDATA[remove blank lines]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=206</guid>
		<description><![CDATA[Today i was trying to write a regular expression to remove blank lines using the PHP method preg_replace. After googling it i found this solution being posted online. PHP: $s = preg_replace("/(^[\r\n]*&#124;[\r\n]+)[\s\t]*[\r\n]+/","",$s); Perl: $s =~ s/(^[\r\n]*&#124;[\r\n]+)[\s\t]*[\r\n]//g; Input: ----------------------- hello ----------------------- Output: ----------------------- hello----------------------- Not very nice. Seems that this expression removes newline characters from cases [...]]]></description>
			<content:encoded><![CDATA[<p>Today i was trying to write a regular expression to remove blank lines using the PHP method preg_replace.<br />
After googling it i found this solution being posted online.</p>
<pre>PHP: $s = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/","",$s);
Perl: $s =~ s/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]//g;</pre>
<p>Input:</p>
<pre>-----------------------

hello

-----------------------</pre>
<p>Output:</p>
<pre>-----------------------
hello-----------------------</pre>
<p>Not very nice. Seems that this expression removes newline characters from cases like &#8220;string\n\n&#8221;.</p>
<p>What it should look like.</p>
<pre>-----------------------
hello
-----------------------</pre>
<p>My solution:</p>
<pre>PHP: $s = preg_replace("/^\n+|^[\t\s]*\n+/m", "", $s);
Perl: $s =~ s/^\n+|^[\t\s]*\n+//mg; #we need to use the g modifier to replace all occurrences preg_replace does this by default.</pre>
<p>Output:</p>
<pre>-----------------------
hello
-----------------------
</pre>
<p>Much better. <img src='http://www.mafiageek.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/206/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

