{"id":25,"date":"2026-01-14T08:20:50","date_gmt":"2026-01-14T08:20:50","guid":{"rendered":"http:\/\/99webtools.com\/10-php-tips-for-web-developer\/"},"modified":"2026-01-14T08:20:50","modified_gmt":"2026-01-14T08:20:50","slug":"10-php-tips-for-web-developer","status":"publish","type":"page","link":"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html","title":{"rendered":"10 PHP tips for web developer"},"content":{"rendered":"<div class=\"col-md-8\">\n<article id=\"post-171\" class=\"post-171 post type-post status-publish format-standard hentry category-php\">\n<header class=\"entry-header\">\n<h1 class=\"entry-title\">10 PHP tips for web developer<\/h1>\n<div class=\"entry-meta\">\n\t\t\t<span class=\"date\"><span class=\"glyphicon glyphicon-time\">&nbsp;<\/span> <a href=\"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html\" title=\"Permalink to 10 PHP tips for web developer\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"2015-07-23T07:33:00+00:00\">July 23, 2015<\/time><\/a><\/span><span class=\"categories-links\"><span class=\"glyphicon glyphicon-folder-open\">&nbsp;<\/span> <a href=\"https:\/\/99webtools.com\/blog\/category\/php.html\" rel=\"category tag\">PHP<\/a><\/span><span class=\"author vcard\"><span class=\"glyphicon glyphicon-user\">&nbsp;<\/span> <a class=\"url fn n\" href=\"https:\/\/99webtools.com\/blog\/author\/sunny.html\" title=\"View all posts by Sunny\" rel=\"author\">Sunny<\/a><\/span>\t\t\t\t\t\t<\/div>\n<\/header>\n<p><!-- .entry-header --><\/p>\n<div class=\"entry-content\">\n<p class=\"bms8vtyd8szzajbcw\">PHP widely used for web development. More than 80% websites on internet are built using php. In this article i\u2019ll tell you 10 most useful tips for php.<span id=\"more-171\">&nbsp;<\/span><\/p>\n<h3>1. Always Use long open tags<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">When you declare a php script always use long tags <code>&lt;?php<\/code> instead of short tags <code>&lt;?<\/code>. Because php configuration on most servers do not allow short tags hence your code will not work.<\/p>\n<h3>2. Use error reporting<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Turn on error reporting on your development server this will help you to find errors in your php code. To turn on error reporting on your server edit php configuration file <code>php.ini<\/code> and set following variables<\/p>\n<pre class=\"brush:text\">error_reporting = E_ALL\ndisplay_errors = On\n<\/pre>\n<p class=\"bms8vtyd8szzajbcw\">If you want to enable error reporting in just current script then add following two lines on top of your php script<\/p>\n<pre class=\"brush:php\">ini_set('display_errors',1);\nerror_reporting(-1);\n<\/pre>\n<h3>3. Use echo instead of print<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Echo is slightly faster than print and echo can take multiple parameter while print takes only one. So always try to use echo instead of print function.<\/p>\n<h3>4. Know the Difference Between Single and Double Quotes<\/h3>\n<p class=\"bms8vtyd8szzajbcw\"><strong>Single quoted strings<\/strong> will display things almost completely &#8220;as is.&#8221; Variables and most escape sequences will not be interpreted. The exception is that to display a literal single quote, you can escape it with a back slash <code>\\'<\/code>, and to display a back slash, you can escape it with another backslash <code>\\\\<\/code><\/p>\n<p class=\"bms8vtyd8szzajbcw\"><strong>Double quote strings<\/strong> will display a host of escaped characters (including some regexps), and variables in the strings will be evaluated. An important point here is that you can use curly braces to isolate the name of the variable you want evaluated. For example let\u2019s say you have the variable <code>$type<\/code> and you what to <code>echo \"The $types are\"<\/code> That will look for the variable <code>$types<\/code>. To get around this use <code>echo \"The {$type}s are\"<\/code> You can put the left brace before or after the dollar sign.<\/p>\n<p class=\"bms8vtyd8szzajbcw\">Example<\/p>\n<pre class=\"brush:php\">$name='sunny';\necho 'my name is $name'; \/\/ my name is $name\necho \"my name is $name\"; \/\/my name is sunny\n<\/pre>\n<h3>5. Use inline comment<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Always use inline comments to annotate your code. It will help to understand the code so anyone can easily modify it in future. Read more about <a href=\"http:\/\/php.net\/manual\/en\/language.basic-syntax.comments.php\" target=\"_blank\">comment in php<\/a><\/p>\n<h3>6. Don\u2019t Store Passwords as Plain text<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Most php beginners  store passwords as plain text in database which can be viewed in database that is not safe. So always use <strong>md5<\/strong> or <strong>sha1<\/strong> to encrypt sensitive data like passwords before storing it in database.<\/p>\n<p class=\"bms8vtyd8szzajbcw\">example<\/p>\n<pre class=\"brush:php\">$passHash=sha1(\"password\");\n<\/pre>\n<h3>7. Filter and validate form data<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Never trust user as they can input any arbitrary code in form which may leads to XSS (cross-site scripting) attack or sql injection. To protect your script from such vulnerability always validate and filter form data before processing.<\/p>\n<h3>8. Use cache in heavy Script<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Most heavy php code takes much time to generate output which casts bad impact on website. To speedup your script always use caching in php script. Here are few caching scripts for php<\/p>\n<ul>\n<li><a href=\"http:\/\/www.danga.com\/memcached\/\" target=\"_blank\">Memcached<\/a><\/li>\n<li>APC<\/li>\n<li>XCache<\/li>\n<li><a href=\"http:\/\/files.zend.com\/help\/Zend-Platform\/zend_cache_api.htm\" target=\"_blank\">Zend Cache<\/a><\/li>\n<li><a href=\"http:\/\/www.eaccelerator.net\/\" target=\"_blank\">eAccelerator<\/a><\/li>\n<li><a href=\"https:\/\/pear.php.net\/package\/Cache_Lite\/\" target=\"_blank\">Cache_Lite<\/a><\/li>\n<\/ul>\n<p class=\"bms8vtyd8szzajbcw\">alternatively you can also enable MySQL query cache to speedup MySQL queries. To enable it add following 3 lines in MySQL configuration file (my.conf)<\/p>\n<pre class=\"brush:text\">query_cache_size = 268435456\nquery_cache_type = 1\nquery_cache_limit = 1048576\n<\/pre>\n<h3>9. Use Captcha verification in forms<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">Hackers may use bots to spam your website by submitting  arbitrary data in forms like comment and contact forms. To protect your website always use captcha verification in form. Here is simple <a href=\"https:\/\/99webtools.com\/blog\/php-simple-captcha-script.html\">php captcha<\/a> script.<\/p>\n<h3>10. Try an IDE<\/h3>\n<p class=\"bms8vtyd8szzajbcw\">IDE\u2019s (Integrated Development Environments) are helpful tools for any developer. A good IDE has features like<\/p>\n<ul>\n<li>Syntax highlighting<\/li>\n<li>Code auto-complete<\/li>\n<li>Debugger<\/li>\n<li>Ftp support<\/li>\n<\/ul>\n<p class=\"bms8vtyd8szzajbcw\">Here is list of my favourite IDE\u2019s<\/p>\n<ol>\n<li>Dreamweaver<\/li>\n<li>Netbeans<\/li>\n<li>Eclipse<\/li>\n<li>PhpStrom<\/li>\n<li>Geany (Linux only)<\/li>\n<\/ol>\n<div class=\"wp_rp_wrap  wp_rp_plain\" id=\"wp_rp_first\">\n<div class=\"wp_rp_content\">\n<h3 class=\"related_post_title\">More from 99webtools<\/h3>\n<ul class=\"related_post wp_rp\">\n<li data-position=\"0\" data-poid=\"in-35\" data-post-type=\"empty\"><a href=\"https:\/\/99webtools.com\/blog\/convert-relative-path-into-absolute-url.html\" class=\"wp_rp_title\">Convert relative path into absolute url<\/a><\/li>\n<li data-position=\"1\" data-poid=\"in-68\" data-post-type=\"empty\"><a href=\"https:\/\/99webtools.com\/blog\/php-script-to-extract-emails.html\" class=\"wp_rp_title\">PHP script to extract emails<\/a><\/li>\n<li data-position=\"2\" data-poid=\"in-44\" data-post-type=\"empty\"><a href=\"https:\/\/99webtools.com\/blog\/php-whois-lookup-class.html\" class=\"wp_rp_title\">PHP whois lookup Class<\/a><\/li>\n<li data-position=\"3\" data-poid=\"in-25\" data-post-type=\"empty\"><a href=\"https:\/\/99webtools.com\/blog\/extract-website-data-using-php.html\" class=\"wp_rp_title\">Extract website data using php<\/a><\/li>\n<li data-position=\"4\" data-poid=\"in-85\" data-post-type=\"empty\"><a href=\"https:\/\/99webtools.com\/blog\/bulk-domain-availability-checker-script.html\" class=\"wp_rp_title\">Bulk domain availability checker script<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div><\/div>\n<p><!-- .entry-content --><\/p>\n<footer>\n<div class=\"comments-link\">\n\t\t\t\t\t<a href=\"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html#respond\"><span class=\"leave-reply\">Leave a reply<\/span><\/a>\t\t\t\t<\/div>\n<p><!-- .comments-link --><br \/>\n\t\t\t\t\t\t\t\t<\/footer>\n<p><!-- .entry-meta --><br \/>\n\t<\/article>\n<p><!-- #post --><br \/>\n<br class=\"clearfix\"><\/p>\n<div class=\"well well-sm text-center\" id=\"subscribe\">\n<h3>Liked It? Get Free updates in your Email<\/h3>\n<form class=\"form\" role=\"form\" action=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify\" method=\"post\" target=\"popupwindow\" onsubmit=\"window.open('https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=99webtools', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true\">\n<div class=\"row\">\n<div class=\"col-md-offset-3 col-md-6\">\n<div class=\"input-group\"><input type=\"text\" name=\"email\" class=\"form-control\" placeholder=\"Enter Email\"><span class=\"input-group-btn\"><button type=\"submit\" value=\"Subscribe\" class=\"btn btn-warning\">Subscribe <i class=\"fa fa-rss\"><\/i><\/button><\/span><\/div>\n<\/div>\n<p><input type=\"hidden\" value=\"99webtools\" name=\"uri\"\/><input type=\"hidden\" name=\"loc\" value=\"en_US\"\/><\/div>\n<p class=\"bms8vtyd8szzajbcw\">Delivered by <img decoding=\"async\" alt=\"feedburner\" src=\"https:\/\/99webtools.com\/files\/img\/feed.png\" border=\"0\"><\/p>\n<\/form>\n<\/div>\n<nav class=\"navigation\">\n<ul class=\"pager\">\n<li class=\"previous\"><a href=\"https:\/\/99webtools.com\/blog\/linkify-all-urls-in-text-with-php.html\" rel=\"prev\"><span class=\"glyphicon glyphicon-arrow-left\">&nbsp;<\/span> Linkify all urls in text with php<\/a><\/li>\n<li class=\"next\"><a href=\"https:\/\/99webtools.com\/blog\/get-profile-picture-from-facebook-google-twitter-and-gravatar.html\" rel=\"next\">Get profile picture from facebook, google, twitter and gravatar <span class=\"glyphicon glyphicon-arrow-right\">&nbsp;<\/span><\/a><\/li>\n<\/ul>\n<\/nav>\n<p><!-- .nav-single --><\/p>\n<div id=\"comments\" class=\"comments-area\">\n<div id=\"respond\" class=\"comment-respond\">\n<h3 id=\"reply-title\" class=\"comment-reply-title\">Leave a Reply <small><a rel=\"nofollow\" id=\"cancel-comment-reply-link\" href=\"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html#respond\" style=\"display:none;\">Cancel Reply<\/a><\/small><\/h3>\n<form action=\"https:\/\/99webtools.com\" method=\"post\" id=\"commentform\" class=\"comment-form\" novalidate>\n<p class=\"comment-notes\"><span id=\"email-notes\">Your email address will not be published.<\/span> Required fields are marked <span class=\"required\">*<\/span><\/p>\n<div class=\"comment-form-comment row\">\n<div class=\"col-md-10\"><label for=\"comment\" class=\"sr-only\">Comment<\/label><textarea id=\"comment\" name=\"comment\" rows=\"8\" aria-required=\"true\" placeholder=\"Comment...\"><\/textarea><\/div>\n<\/div>\n<div class=\"comment-form-author row\">\n<div class=\"col-md-6\"><label for=\"author\" class=\"sr-only\">Name<\/label> <\/p>\n<div class=\"input-group\"><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-user\">&nbsp;<\/span><br \/>\n<\/span><input id=\"author\" class=\"form-control\" name=\"author\" type=\"text\" value=\"\" size=\"30\" aria-required=\"true\" placeholder=\"Name\"><\/div>\n<\/div>\n<\/div>\n<div class=\"comment-form-email row\">\n<div class=\"col-md-6\"><label for=\"email\" class=\"sr-only\">Email<\/label> <\/p>\n<div class=\"input-group\"><span class=\"input-group-addon\"><span class=\"glyphicon glyphicon-envelope\">&nbsp;<\/span><br \/>\n<\/span><input id=\"email\" class=\"form-control\" name=\"email\" type=\"email\" value=\"\" size=\"30\" aria-required=\"true\" placeholder=\"Email\"><\/div>\n<\/div>\n<\/div>\n<p class=\"comment-form-cookies-consent\"><input id=\"wp-comment-cookies-consent\" name=\"wp-comment-cookies-consent\" type=\"checkbox\" value=\"yes\"\/> <label for=\"wp-comment-cookies-consent\">Save my name, email, and website in this browser for the next time I comment.<\/label><\/p>\n<p class=\"form-submit\"><input name=\"submit\" type=\"submit\" id=\"submit\" class=\"submit\" value=\"Post Comment\"\/> <input type=\"hidden\" name=\"comment_post_ID\" value=\"171\" id=\"comment_post_ID\"\/><br \/>\n<input type=\"hidden\" name=\"comment_parent\" id=\"comment_parent\" value=\"0\"\/>\n<\/p>\n<p style=\"display: none;\"><input type=\"hidden\" id=\"akismet_comment_nonce\" name=\"akismet_comment_nonce\" value=\"2cc80dacd1\"\/><\/p>\n<p style=\"display: none;\"><input type=\"hidden\" id=\"ak_js\" name=\"ak_js\" value=\"41\"\/><\/p>\n<\/form><\/div>\n<p><!-- #respond -->\n<\/div>\n<p><!-- #comments .comments-area -->\n\t\t<\/div>\n","protected":false,"raw":""},"excerpt":{"rendered":"<p>10 PHP tips for web developer &nbsp; July 23, [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template_3.php","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-25","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>10 PHP tips for web developer - Web Tools<\/title>\n<meta name=\"description\" content=\"PHP widely used for web development. More than 80% websites on internet are built using php. In this article i&#039;ll tell you 10 most useful tips for php. 1.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"10 PHP tips for web developer - Web Tools\" \/>\n<meta property=\"og:description\" content=\"PHP widely used for web development. More than 80% websites on internet are built using php. In this article i&#039;ll tell you 10 most useful tips for php. 1.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html\" \/>\n<meta property=\"og:site_name\" content=\"Web tools | SEO tools | Web development articles\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Ber\u00e4knad l\u00e4stid\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minuter\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"10 PHP tips for web developer - Web Tools","description":"PHP widely used for web development. More than 80% websites on internet are built using php. In this article i'll tell you 10 most useful tips for php. 1.","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:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html","og_type":"article","og_title":"10 PHP tips for web developer - Web Tools","og_description":"PHP widely used for web development. More than 80% websites on internet are built using php. In this article i'll tell you 10 most useful tips for php. 1.","og_url":"https:\/\/99webtools.com\/blog\/10-php-tips-for-web-developer.html","og_site_name":"Web tools | SEO tools | Web development articles","twitter_card":"summary_large_image","twitter_misc":{"Ber\u00e4knad l\u00e4stid":"4 minuter"}},"_links":{"self":[{"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/pages\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/types\/page"}],"replies":[{"embeddable":true,"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":0,"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/pages\/25\/revisions"}],"wp:attachment":[{"href":"https:\/\/99webtools.com\/wp-json\/wp\/v2\/media?parent=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}