Skip to content
Advertisement

Tag: readability

How to make SQL query more readable in PHP?

When you have a long fields in SQL query, how do you make it more readable? For example: Answer You can concatenate it like this to make it more readable: Note: Be sure while concatinating your query, don’t forget to leave spaces before you start a new line between your double quotes, else you’ll get query invalid error

How to reduce the number of if-else statements in PHP?

I found that there are many if-else statements, especially nested if else statements, these statements make my code less readable. How to reduce the number of if else statements in PHP? My tips are as follows: 1.Use a switch statement when it is suitable; 2.use exit() statement when it is feasible; 3. Use ternary statement when it is feasible; Are

Advertisement