{"id":235,"date":"2013-05-23T06:04:59","date_gmt":"2013-05-23T06:04:59","guid":{"rendered":"http:\/\/www.siriinnovations.com\/blog\/?p=235"},"modified":"2013-05-23T10:25:33","modified_gmt":"2013-05-23T10:25:33","slug":"basic-php-programming-standards","status":"publish","type":"post","link":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/","title":{"rendered":"Basic PHP programming standards"},"content":{"rendered":"<p>Everyone should follow some coding standards. It is required because there may be many developers working on different modules of one project; if they follow their own standards the code may become very un-manageable. It is very difficult to maintain the code in future.<\/p>\n<p><b>Reasons to follow standards:<\/b><\/p>\n<ol>\n<li>Your co-programmers should understand your code. A coding standard acts like a blueprint for the team.<\/li>\n<li>Simple and clear code will reduce your common mistakes.<\/li>\n<li>If you revise your code after some days, it is easy to understand that code.<\/li>\n<li>For best quality project you should follow the coding standards.<\/li>\n<\/ol>\n<p>Here are some coding tips to follow for better result:<\/p>\n<ol>\n<li><b>Text indenting and line length:<\/b> It is better to maintain text indenting and particular line length while coding. For text indenting use four spaces instead of tab, because different computers may take different settings for tab. It is better to maintain the line length approximately 75-85 characters long for better reading.<\/li>\n<li><b>Control structures:<\/b> Control statements should have one space between keyword and opening parenthesis, to make a difference between function calls and control statements. It is recommended to use curly braces even though it is optional.<\/li>\n<li><b>Function calls:<\/b> Functions should be called with no space between name and opening parenthesis, and the first parameter, spaces between commas and each parameter, and no space between last parameter and closing parenthesis.<\/li>\n<li><b>Function definitions:<\/b> Function names should follow the allman style.<\/li>\n<li><b>Comments:<\/b> Use C style comments\u00a0(\/* *\/) and standard C++ (\/\/) style comments.<\/li>\n<li><b>Variable names:<\/b><\/li>\n<\/ol>\n<ul>\n<ul>\n<ul>\n<li>Use lower case letters<\/li>\n<li>Use \u2018_\u2019 as word separator.<\/li>\n<li>Global variables should be prepended with \u2018g\u2019<\/li>\n<li>Static variables should be prepended with \u2018s\u2019<\/li>\n<li>Global constants should be all caps with \u2018_\u2019 separator<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<p>7.\u00a0One statement per one line<\/p>\n<p>Here is the set of tips to follow to become a good PHP developer.<\/p>\n<ol>\n<li> <b><\/b><b>Don\u2019t use PHP short tags:<\/b><\/li>\n<\/ol>\n<p>Short_open_tags is an ini setting. By default it is enabled in PHP 5.3, but every server not run PHP 5.3. It is more important to use PHP full tags in compatibility and portability.<\/p>\n<p><b>\u00a0 \u00a0 \u00a0 \u00a02.\u00a0<\/b><b>Stop using MySQL Library:<\/b><\/p>\n<p>It is better to stop using MySQL library functions as they have not updated in some time.<\/p>\n<p>Use MySQLi or PDO<\/p>\n<p><b>\u00a0 \u00a0 \u00a0 \u00a03.\u00a0<\/b><b>Use array functions and string functions:<\/b><\/p>\n<p>While working with arrays and strings it is more important to use functions instead of writing your own code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Everyone should follow some coding standards. It is required because there may be many developers working on different modules of one project; if they follow their own standards the code may become very un-manageable. It is very difficult to maintain the code in future. Reasons to follow standards: Your co-programmers should understand your code. A [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,15,6],"tags":[],"class_list":["post-235","post","type-post","status-publish","format-standard","hentry","category-development","category-tips","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Basic PHP programming standards - Siri Innovations<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Basic PHP programming standards - Siri Innovations\" \/>\n<meta property=\"og:description\" content=\"Everyone should follow some coding standards. It is required because there may be many developers working on different modules of one project; if they follow their own standards the code may become very un-manageable. It is very difficult to maintain the code in future. Reasons to follow standards: Your co-programmers should understand your code. A [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\" \/>\n<meta property=\"og:site_name\" content=\"Siri Innovations\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-23T06:04:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-05-23T10:25:33+00:00\" \/>\n<meta name=\"author\" content=\"Shilpa Buddha\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shilpa Buddha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\"},\"author\":{\"name\":\"Shilpa Buddha\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d\"},\"headline\":\"Basic PHP programming standards\",\"datePublished\":\"2013-05-23T06:04:59+00:00\",\"dateModified\":\"2013-05-23T10:25:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\"},\"wordCount\":390,\"commentCount\":0,\"articleSection\":[\"Development\",\"Tips\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\",\"url\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\",\"name\":\"Basic PHP programming standards - Siri Innovations\",\"isPartOf\":{\"@id\":\"https:\/\/siriinnovations.com\/blog\/#website\"},\"datePublished\":\"2013-05-23T06:04:59+00:00\",\"dateModified\":\"2013-05-23T10:25:33+00:00\",\"author\":{\"@id\":\"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d\"},\"breadcrumb\":{\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/siriinnovations.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Basic PHP programming standards\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/#website\",\"url\":\"https:\/\/siriinnovations.com\/blog\/\",\"name\":\"Technical blog from Siri Innovations\",\"description\":\"Innovative like no other\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/siriinnovations.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d\",\"name\":\"Shilpa Buddha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c4d3d50337b9882c866fe638d3af530f0503e9e499ee77e4e53f9e34605abbe5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c4d3d50337b9882c866fe638d3af530f0503e9e499ee77e4e53f9e34605abbe5?s=96&d=mm&r=g\",\"caption\":\"Shilpa Buddha\"},\"url\":\"https:\/\/siriinnovations.com\/blog\/author\/shilpa-buddha\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Basic PHP programming standards - Siri Innovations","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/","og_locale":"en_US","og_type":"article","og_title":"Basic PHP programming standards - Siri Innovations","og_description":"Everyone should follow some coding standards. It is required because there may be many developers working on different modules of one project; if they follow their own standards the code may become very un-manageable. It is very difficult to maintain the code in future. Reasons to follow standards: Your co-programmers should understand your code. A [&hellip;]","og_url":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/","og_site_name":"Siri Innovations","article_published_time":"2013-05-23T06:04:59+00:00","article_modified_time":"2013-05-23T10:25:33+00:00","author":"Shilpa Buddha","twitter_misc":{"Written by":"Shilpa Buddha","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#article","isPartOf":{"@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/"},"author":{"name":"Shilpa Buddha","@id":"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d"},"headline":"Basic PHP programming standards","datePublished":"2013-05-23T06:04:59+00:00","dateModified":"2013-05-23T10:25:33+00:00","mainEntityOfPage":{"@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/"},"wordCount":390,"commentCount":0,"articleSection":["Development","Tips","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/","url":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/","name":"Basic PHP programming standards - Siri Innovations","isPartOf":{"@id":"https:\/\/siriinnovations.com\/blog\/#website"},"datePublished":"2013-05-23T06:04:59+00:00","dateModified":"2013-05-23T10:25:33+00:00","author":{"@id":"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d"},"breadcrumb":{"@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/siriinnovations.com\/blog\/basic-php-programming-standards\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/siriinnovations.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Basic PHP programming standards"}]},{"@type":"WebSite","@id":"https:\/\/siriinnovations.com\/blog\/#website","url":"https:\/\/siriinnovations.com\/blog\/","name":"Technical blog from Siri Innovations","description":"Innovative like no other","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/siriinnovations.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/e8e1f72a882fe505ca12b49a7d1d8f5d","name":"Shilpa Buddha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/siriinnovations.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c4d3d50337b9882c866fe638d3af530f0503e9e499ee77e4e53f9e34605abbe5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c4d3d50337b9882c866fe638d3af530f0503e9e499ee77e4e53f9e34605abbe5?s=96&d=mm&r=g","caption":"Shilpa Buddha"},"url":"https:\/\/siriinnovations.com\/blog\/author\/shilpa-buddha\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/posts\/235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/comments?post=235"}],"version-history":[{"count":9,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/posts\/235\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/posts\/235\/revisions\/269"}],"wp:attachment":[{"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/media?parent=235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/categories?post=235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/siriinnovations.com\/blog\/wp-json\/wp\/v2\/tags?post=235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}