<?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>Comments on: Good and Bad PHP Code</title>
	<atom:link href="http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<lastBuildDate>Sat, 07 Nov 2009 23:35:20 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: adrian</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-861745</link>
		<dc:creator>adrian</dc:creator>
		<pubDate>Wed, 14 Jan 2009 00:12:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-861745</guid>
		<description>What PHP coder do you recommend instead of using a server any time to checkde code?</description>
		<content:encoded><![CDATA[<p>What PHP coder do you recommend instead of using a server any time to checkde code?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-843851</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 04 Dec 2008 13:15:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-843851</guid>
		<description>
alert(&#039;here&#039;);
</description>
		<content:encoded><![CDATA[<p>alert(&#8217;here&#8217;);</p>]]></content:encoded>
	</item>
	<item>
		<title>By: online forex trading platform</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-784801</link>
		<dc:creator>online forex trading platform</dc:creator>
		<pubDate>Fri, 22 Aug 2008 19:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-784801</guid>
		<description>I&#039;m todally agree with you that you can learnd a lot about the programmer by asking him this question,i very like the writing of this great artice.

Keep them coming.</description>
		<content:encoded><![CDATA[<p>I&#8217;m todally agree with you that you can learnd a lot about the programmer by asking him this question,i very like the writing of this great artice.</p>
<p>Keep them coming.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Befara</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-379972</link>
		<dc:creator>Befara</dc:creator>
		<pubDate>Thu, 13 Sep 2007 20:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-379972</guid>
		<description>My feeling is that your above example is something that can be taught fairly easily. Granted, it&#039;s desirable to have a candidate who has enought experience to know what the major security vulnerabilities are and how to address them, but I&#039;m more interested in whether a developer &quot;gets it&quot; -- that is understands the overriding concepts in architecting good code.

When I interview a LAMP candidate I&#039;m usually looking first at what kind of OOP experience they have. Do they know the difference between an object and a class? Do they understand inheritance, extending classes? Have they ever used any common design patterns? Singletons? Factory methods? Do they know what $this is? If you have an kind of enterprise codebase, it&#039;s essential to understand the big picture if you are going to make meaningful contributions.

I would be extremely happy in your above example if a developer simply said to me: &quot;User input should never be trusted, the $_GET argument should be run through a sanitation method then placed in an appropriately named array, i.e. $clean[&#039;query&#039;]&quot;.</description>
		<content:encoded><![CDATA[<p>My feeling is that your above example is something that can be taught fairly easily. Granted, it&#8217;s desirable to have a candidate who has enought experience to know what the major security vulnerabilities are and how to address them, but I&#8217;m more interested in whether a developer &#8220;gets it&#8221; &#8212; that is understands the overriding concepts in architecting good code.</p>
<p>When I interview a LAMP candidate I&#8217;m usually looking first at what kind of OOP experience they have. Do they know the difference between an object and a class? Do they understand inheritance, extending classes? Have they ever used any common design patterns? Singletons? Factory methods? Do they know what $this is? If you have an kind of enterprise codebase, it&#8217;s essential to understand the big picture if you are going to make meaningful contributions.</p>
<p>I would be extremely happy in your above example if a developer simply said to me: &#8220;User input should never be trusted, the $_GET argument should be run through a sanitation method then placed in an appropriately named array, i.e. $clean['query']&#8220;.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: marnen</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-322354</link>
		<dc:creator>marnen</dc:creator>
		<pubDate>Wed, 01 Aug 2007 18:54:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-322354</guid>
		<description>&lt;blockquote&gt;Passing the ENT_QUOTES argument to htmlspecialchars to ensure that single quotes (&#039;) are also escaped isn’t strictly necessary in this case, but it’s a good habit to get into.&lt;/blockquote&gt;&lt;p&gt;Um, why do this if it &quot;isn&#039;t strictly necessary&quot;? As far as I can tell, this practice is of no use whatsoever in this or any other case. If you&#039;re escaping &lt;, &gt;, &amp;, and perhaps &quot;, that&#039;s all you need.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<blockquote><p>Passing the ENT_QUOTES argument to htmlspecialchars to ensure that single quotes (&#8217;) are also escaped isn’t strictly necessary in this case, but it’s a good habit to get into.</p></blockquote>
<p>Um, why do this if it &#8220;isn&#8217;t strictly necessary&#8221;? As far as I can tell, this practice is of no use whatsoever in this or any other case. If you&#8217;re escaping &lt;, &gt;, &amp;, and perhaps &quot;, that&#8217;s all you need.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Kejser Hansen</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-297683</link>
		<dc:creator>Hans Kejser Hansen</dc:creator>
		<pubDate>Sun, 08 Jul 2007 12:01:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-297683</guid>
		<description>Don&#039;t think You better example is an example on good php code. I alway s uses wrapper function when calling htmlpecialchars, so i easyly can change the third parameter if needed. (Guess I will find a job another place, where they avoid redundant code.)

&quot;Passing the ENT_QUOTES argument to htmlspecialchars to ensure that single quotes (&#039;) are also escaped isn’t strictly necessary in this case, but it’s a good habit to get into.&quot;
Very dependent on the context, fx can be a very bad habbit when used i generateed javascript. Also a place where I prefer a wrapper function.

And the little issues about () around echo, I would read the company&#039;s code standard, before I removed it.

And one thing IHMO that makes good PHP code, is the planning before You opens the editor.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t think You better example is an example on good php code. I alway s uses wrapper function when calling htmlpecialchars, so i easyly can change the third parameter if needed. (Guess I will find a job another place, where they avoid redundant code.)</p>
<p>&#8220;Passing the ENT_QUOTES argument to htmlspecialchars to ensure that single quotes (&#8217;) are also escaped isn’t strictly necessary in this case, but it’s a good habit to get into.&#8221;<br />
Very dependent on the context, fx can be a very bad habbit when used i generateed javascript. Also a place where I prefer a wrapper function.</p>
<p>And the little issues about () around echo, I would read the company&#8217;s code standard, before I removed it.</p>
<p>And one thing IHMO that makes good PHP code, is the planning before You opens the editor.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Webx</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-271819</link>
		<dc:creator>Webx</dc:creator>
		<pubDate>Mon, 11 Jun 2007 05:47:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-271819</guid>
		<description>PHP simply is not being taken seriously for many reasons. A perfect example to this thought process focuses on this general discussion actually, in which nobody can agree on anything. The same is present and constantly persistent with PHP code and how to do something the &quot;right&quot; way.

Sessions, security and even Cookies, all have the same areas that compound with a vast amount of opinions, too many ways of producing the same code (OOP or simplified functions) that do the same thing and way too many controversies on how to produce the most secure code with no real answer.

You can simply confuse yourself to the point of mental breakdown just looking for a correct way of handling security issues pertaining to sessions.

And no, that is not a good thing. Having too many options to produce code is why PHP is constantly under the microscope and controversy of &quot;secure applications&quot; and why most employers dont take PHP seriously. After all, the general misconception is that most of us that develop PHP applications are simply people that stumbled onto a easy format to program with and as a result, think we are developers. The same thought process exudes highly in most college campuses that rely stringently on Flash, Java and .NET curriculum. When you walk into a college and see a Microsoft plaque of recognition and sponsorship hanging on the wall, you can pretty much forget programming in PHP.

So, what does that have to do with anything? Where do you go to school to get a Bachelors degree in PHP programming? Where do you go to get a Masters degree in PHP programming? Nowhere really. At least around here. There is no such thing. But, if you want to be a .NET, Java or Flash developer, I can show you 30 jobs that I received in just the last 4 days.

Employers want to see that Degree hanging on your wall and use that degree to base their pay rates upon, whether or not the technology you use is actually better than what they are using.

Just think of it like this, to make it real short and sweet. Why do most employers use M$ servers and not Linux servers?</description>
		<content:encoded><![CDATA[<p>PHP simply is not being taken seriously for many reasons. A perfect example to this thought process focuses on this general discussion actually, in which nobody can agree on anything. The same is present and constantly persistent with PHP code and how to do something the &#8220;right&#8221; way.</p>
<p>Sessions, security and even Cookies, all have the same areas that compound with a vast amount of opinions, too many ways of producing the same code (OOP or simplified functions) that do the same thing and way too many controversies on how to produce the most secure code with no real answer.</p>
<p>You can simply confuse yourself to the point of mental breakdown just looking for a correct way of handling security issues pertaining to sessions.</p>
<p>And no, that is not a good thing. Having too many options to produce code is why PHP is constantly under the microscope and controversy of &#8220;secure applications&#8221; and why most employers dont take PHP seriously. After all, the general misconception is that most of us that develop PHP applications are simply people that stumbled onto a easy format to program with and as a result, think we are developers. The same thought process exudes highly in most college campuses that rely stringently on Flash, Java and .NET curriculum. When you walk into a college and see a Microsoft plaque of recognition and sponsorship hanging on the wall, you can pretty much forget programming in PHP.</p>
<p>So, what does that have to do with anything? Where do you go to school to get a Bachelors degree in PHP programming? Where do you go to get a Masters degree in PHP programming? Nowhere really. At least around here. There is no such thing. But, if you want to be a .NET, Java or Flash developer, I can show you 30 jobs that I received in just the last 4 days.</p>
<p>Employers want to see that Degree hanging on your wall and use that degree to base their pay rates upon, whether or not the technology you use is actually better than what they are using.</p>
<p>Just think of it like this, to make it real short and sweet. Why do most employers use M$ servers and not Linux servers?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Soaplady</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-271717</link>
		<dc:creator>Soaplady</dc:creator>
		<pubDate>Mon, 11 Jun 2007 03:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-271717</guid>
		<description>I started using PHP when I had databse experience but no other programming skill.  Now, several websites and many hours of reading and practice, I can say that I did get most of the points for &quot;good programming&quot; right.

It is true that anyone with a little smarts can create a decent (and sometimes pretty sophisticated) php website.  And that, I think, is what most employers see.  

However, the real difficulty is that getting from the decent to the elegant and from the pretty safe to the really secure is a hard road.  There are few available classes and very little training exists.  Learning from books and the school of hard knocks is difficult, especially when there are many ways of doing just about everything in PHP.

I&#039;ve gotten to the point where I do get paid for my work as a contractor building database-driven websites. Maybe not a LOT, but enough so that I feel decent about the resultant hourly wage.

Most of the &quot;how-to&quot; materials for advanced php programming assumes an understanding of some other language. Available information is often contradictory and incomplete.  The php manual is excellent, but only if you know what you&#039;re looking for to start with.

PHP programmers will probably become more standardly paid when there is a clearly defined path charting the beginner, novice, amateur, advanced, professional and master.  It will also be easier for php programmers (and scripters) to get better at their skills.  

Once there are more truly professional and master php programmers, then we&#039;ll see more advanced enterprise websites built and running with php.  And THAT is what will get higher pay for all of us.</description>
		<content:encoded><![CDATA[<p>I started using PHP when I had databse experience but no other programming skill.  Now, several websites and many hours of reading and practice, I can say that I did get most of the points for &#8220;good programming&#8221; right.</p>
<p>It is true that anyone with a little smarts can create a decent (and sometimes pretty sophisticated) php website.  And that, I think, is what most employers see.  </p>
<p>However, the real difficulty is that getting from the decent to the elegant and from the pretty safe to the really secure is a hard road.  There are few available classes and very little training exists.  Learning from books and the school of hard knocks is difficult, especially when there are many ways of doing just about everything in PHP.</p>
<p>I&#8217;ve gotten to the point where I do get paid for my work as a contractor building database-driven websites. Maybe not a LOT, but enough so that I feel decent about the resultant hourly wage.</p>
<p>Most of the &#8220;how-to&#8221; materials for advanced php programming assumes an understanding of some other language. Available information is often contradictory and incomplete.  The php manual is excellent, but only if you know what you&#8217;re looking for to start with.</p>
<p>PHP programmers will probably become more standardly paid when there is a clearly defined path charting the beginner, novice, amateur, advanced, professional and master.  It will also be easier for php programmers (and scripters) to get better at their skills.  </p>
<p>Once there are more truly professional and master php programmers, then we&#8217;ll see more advanced enterprise websites built and running with php.  And THAT is what will get higher pay for all of us.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ivanfx</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-271152</link>
		<dc:creator>ivanfx</dc:creator>
		<pubDate>Sun, 10 Jun 2007 14:13:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-271152</guid>
		<description>Good old Notepad...</description>
		<content:encoded><![CDATA[<p>Good old Notepad&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: praveen</title>
		<link>http://www.sitepoint.com/blogs/2007/05/25/good-and-bad-php-code/comment-page-2/#comment-270473</link>
		<dc:creator>praveen</dc:creator>
		<pubDate>Sat, 09 Jun 2007 19:16:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1929#comment-270473</guid>
		<description>Hi,

I have worked on PHP/ JSP/ .NET but have a feeling that.. compared to ASP.net and Java, PHP don&#039;t have a proper IDE. I am aware that lot of IDE&#039;s from zend, eclipse, Nusphere etc are there in the market. But personally I don&#039;t find any of them useful and handy like Visual studio or Net beans.

I will appreciate your comments on this. And will like to know how you are managing it?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have worked on PHP/ JSP/ .NET but have a feeling that.. compared to ASP.net and Java, PHP don&#8217;t have a proper IDE. I am aware that lot of IDE&#8217;s from zend, eclipse, Nusphere etc are there in the market. But personally I don&#8217;t find any of them useful and handy like Visual studio or Net beans.</p>
<p>I will appreciate your comments on this. And will like to know how you are managing it?</p>]]></content:encoded>
	</item>
</channel>
</rss>
