Wednesday, 17 January 2018

Top 10 PHP Tips for Developers


                            
I have for the longest time been  to compose an article this way, since I consider everything the time - what 10 things would I regard the most critical to pass on to another person?

1) Go OOP

On the off chance that you have not yet entered the domain of Object Oriented Programming, at that point you are off guard, and you are falling behind quick.
OOP is basically a technique for programming with the utilization of classes, or Objects, which entwine like things, evacuate the requirement for reiteration of code and play out the fundamental errands of generation just.

2) Stay Away from Anything Ending With _once()

We as a whole realize that incorporate() essentially gives us a notice on the off chance that it comes up short, while require() murders the content with a deadly mistake when it falls flat.

What we keep in mind is that include_once() and require_once() is to a great degree hard on server assets. There is nothing we can do about it, it's the way PHP is set up.

3) Develop With Error Reporting On

The main thing you do when beginning another task is to turn mistake answering to E_ALL, and you should just turn it off ten seconds previously going to generation mode


4) Use A Framework If You Need One

Ok, so you shouldn't use a framework because he could quite conclusively prove that a framework is much slower than normal PHP code when it came to printing a simple "Hello World" application.

Two things to mention here though: you are not Rasmus Lerdorf and I bet you won't be building a "Hello World" application every time you program something.

5) Use PHP's Inbuilt Functions
Ok, you want to count the amount of keys in an array? You can loop through the array and simply increment a value for each iteration, right. PHP has many built-in functions that can do what you need them to, so check out the manual to make sure you are doing it in the best way possible.

6) Protect Your Database

The best and safest way is to use mysql_real_escape_string() for all database before it is added to the database. This function makes all strings safe in terms of quotes and other functions that can harm your database or contain malicious code, so use it to be sure you have taken the first step against protection of your data

7) Use POST Not GET

Ok, this isn't always possible, but when its really not necessary, don't use GET, use POST. The reason is simple - GET is simple to emulate, all I need to do is add something to my address bar and I can hack your project.

 8) Draw Before You Code

A good practice to get into is to wireframe your projects, even if you are just scribbling a few notes on a piece of paper. It is very important to actually give the mechanics of you application some thought before sitting down to start coding.

9) Understand Your Project

A craftsman can't draw something that he has not seen some time recently. An artist can't sing a tune that he has not heard some time recently. You can't code an undertaking that you don't completely get it. On the off chance that you don't see precisely what it needs to do, and how it needs to it, you can't manufacture it.

10) Code
On the off chance that I could make them thing through to anybody perusing this, this is it. You can't turn into a decent engineer by perusing. You can't turn into a decent engineer by watching somebody create.

The unrivaled attempted and confided in strategy, is to really compose code. Be that as it may, - and here is the trap - fabricate genuine articles! Try not to go and code something that you have no enthusiasm for, or will never utilize. Assemble what you like, and you will be energized and intrigued by it, and you will learn. At that point, make it magnificent, expand upon it, and improve it.




4 comments:

  1. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site. keep it up
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  2. Thanks for sharing a valuable info.. I would also like to share for Data Science Social Prachar is the best institute and for more info visit: https://socialprachar.com/data-science-training-in-bengaluru/

    ReplyDelete

JAVA INTERVIEW QUESTIONS AND ANSWERS

Are Looking for Java Training? Learn Advanced Java Besant advances – Only Institute with Oracle Authorized Java Training Center...