{"id":1523,"date":"2018-01-19T19:22:56","date_gmt":"2018-01-19T19:22:56","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/best-practices-php-coding-style\/"},"modified":"2018-01-19T19:24:51","modified_gmt":"2018-01-19T19:24:51","slug":"best-practices-php-coding-style","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/best-practices-php-coding-style\/","title":{"rendered":"Best Practices: PHP Coding Style"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Tim Perdue<\/div>\n<div class=\"\">on January 3, 2001<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/tim2.jpg\" class=\"articleAuthorImg\" alt=\"picture of Tim Perdue\" height=\"90\" width=\"100\" align=\"left\"\/><\/p>\n<div class=\"articlePara\">\nOne of PHP&#8217;s greatest strengths can also be a great weakness in the wrong<br \/>\nhands. I&#8217;m talking about its forgiving nature. One of the reasons why<br \/>\nPHP has become so wildly popular is because it lets very inexperienced<br \/>\nweb developers build powerful applications without much planning, consistency,<br \/>\nor documentation.<\/div>\n<div class=\"articlePara\">\nUnfortunately, that means an awful lot of PHP code out there is sloppy,<br \/>\nhard to read and impossible to maintain. I know because I&#8217;ve written a lot<br \/>\nof it ;-).<\/div>\n<div class=\"articlePara\">\nTo address this and a lot of other issues, a number of the core PHP<br \/>\ndevelopers and community members got together and started the PEAR<br \/>\nProject, which stands for PHP Extension and Add-on Repository.<br \/>\nTo date, the docs and other fruit from the PEAR project have been pretty<br \/>\nsparse and difficult to follow, so this article is an attempt to shed some<br \/>\nlight on what they&#8217;re doing.<\/div>\n<div class=\"articlePara\">\nA pretty huge part of maintainability of code is how it is formatted<br \/>\nand commented. All code throughout a given project should be formatted the same<br \/>\nway. I&#8217;m a pretty big stickler about this in the SourceForge codebase and<br \/>\nyou should be too.<\/div>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">1<\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim200101014658.html?page=2\">2<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim200101019ba9.html?page=3\">3<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim20010101fdb0.html?page=4\">4<\/a> <\/div>\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"tim200101014658.html?page=2\">Next Page \u00bb<\/a><\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>By Tim Perdue on January 3, 2001 One of PHP&#8217;s greatest strengths can also be a great weakness in the wrong hands. I&#8217;m talking about its forgiving nature. One of the reasons why PHP has become so wildly popular is because it lets very inexperienced web developers build powerful applications&#8230; <a href=\"https:\/\/phpbuilder.com\/best-practices-php-coding-style\/\" class=\"readmore\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1523","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1523"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1523\/revisions"}],"predecessor-version":[{"id":2270,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1523\/revisions\/2270"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}