{"id":17,"date":"2017-04-21T14:15:35","date_gmt":"2017-04-21T14:15:35","guid":{"rendered":"http:\/\/rpg20.com\/blog\/?p=17"},"modified":"2017-04-21T14:15:35","modified_gmt":"2017-04-21T14:15:35","slug":"why-php","status":"publish","type":"post","link":"https:\/\/rpg20.com\/blog\/2017\/04\/21\/why-php\/","title":{"rendered":"Why PHP?"},"content":{"rendered":"<p>PHP seems to have a bad reputation.<\/p>\n<p>If you search the web, you&#8217;ll find tons of rants on how PHP is terrible, flawed by design, and some even less flattering stuff. But I don&#8217;t share the sentiment. I think that PHP&#8217;s main crime was being attractive to too many crappy developers.<\/p>\n<h2>My Love\/Hate affair with Java<\/h2>\n<p>I learned Java back in the mid-to-late 90s. Beans was still considered new and Swing was expected to be the next big thing.<\/p>\n<p>I loved it. It was simple, elegant and worry-free. Write once and let JVM worry about the rest. What could possible go wrong?<\/p>\n<p>IMO: it was overused (and a bit bloated).<\/p>\n<p>Take the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Eclipse_(software)\">Eclipse IDE<\/a>, for example. Sure, nowadays it works fast enough on any decent computer. But 10+ years ago, it was more resource hungry than what most affordable PCs could deliver. Would I choose to write an IDE in Java? Maybe today I&#8217;d consider it, but it wouldn&#8217;t be my first choice.<\/p>\n<p>Around that time, lots of stuff was being written in Java. Everybody <em>had<\/em> to know Java if they wanted to have a job, and we&#8217;d get freshly-minted programmers insisting that they could do device driver development in Java.<\/p>\n<p>So I learned to hate Java.<\/p>\n<h2>Enter PHP<\/h2>\n<p>I was convinced to learn PHP mainly because of the expected speed of development. I wouldn&#8217;t have thought to program in anything other than Perl at the time, but a friend talked me into it for a small side project. I loved how fast and easy it was to do something useful with MySQL.<\/p>\n<h3>The &#8220;register globals&#8221; incident<\/h3>\n<p>Yes, this was one big design mistake. I&#8217;ll even admit it: at one time I did rely on register_globals. Guilty as charged. Maybe we didn&#8217;t know any better. But even if the PHP group changed this more than 15 years ago, it seems like the detractors haven&#8217;t forgotten.<\/p>\n<p>Yes I have written crappy bits of code (other than the register_globals). Many of those crappy bits are still in the current codebase. And yes, I feel kind of ashamed.<\/p>\n<h2>There is no absolute &#8220;best&#8221; language<\/h2>\n<p>In the same way we can&#8217;t (and shouldn&#8217;t) use Java to write low-level software, we shouldn&#8217;t use Assembly language to write a cross-platform word processor.<\/p>\n<p>Lots of people have a &#8220;favorite&#8221; language and will defend it fiercely. But languages are tools and some may be better that others <em>given a specific purpose<\/em>.<\/p>\n<p>Whether due to laziness, ignorance, or <a href=\"http:\/\/www.ioccc.org\/\">just for fun<\/a>: you can write crappy software in any language. You may want to complain about that weird way PHP handles dynamic typing, or comparison operators&#8230; and you may be right.<\/p>\n<p>I might even agree with you if you decide to choose another language for your next project.<\/p>\n<p>And if it&#8217;s not your choice to make, best I can do is recommend that you use version control, stick to a coding standard, and test early.<\/p>\n<p>Every language sucks. And every language is beautiful.<\/p>\n<p>Seriously.<\/p>\n<h2>So&#8230; why PHP?<\/h2>\n<p>The way I see it, PHP is great for rapid development of (non-critical) websites.<\/p>\n<p>I don&#8217;t allocate a lot of time to this site&#8217;s development, so I need to be able to get a complete function or <em>block<\/em> of code done in a very small amount of time. PHP is good for this.<\/p>\n<p>It&#8217;s about moving forward.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP seems to have a bad reputation. If you search the web, you&#8217;ll find tons of rants on how PHP is terrible, flawed by design, and some even less flattering stuff. But I don&#8217;t share the sentiment. I think that PHP&#8217;s main crime was being attractive to too many crappy developers. My Love\/Hate affair with &hellip; <a href=\"https:\/\/rpg20.com\/blog\/2017\/04\/21\/why-php\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Why PHP?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[4],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-development"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":4,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/posts\/17\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rpg20.com\/blog\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}