PHP Interview Question Answers : How to debug in PHP

We will discuss best practices to troubleshoot and debug PHP script. One of the very common interview questions we have seen is – How to debug in PHP or How would you troubleshoot your PHP code. 

Debugging PHP can often be tricky. Various flavors of PHP e.g. PHP 5.3 vs. PHP 5.4 can throw different warnings or run-time errors depends upon the type of code written. In addition, programmers are not able to change or update PHP code on the fly using tool such as chrome debugger; which makes PHP debugging very tricky and time consuming.

We will discuss best practices as to how you can troubleshoot PHP code.

Continue reading

PHP Redirect : How to make a redirect in PHP?

Let’s learn about how to make a redirect in PHP. There are various ways to make redirects in PHP. In this article we will discuss what are some of the best ways to redirect your PHP page.

You are wondering now. Why do we want to redirect a PHP instead of sticking to the page the user is in.

Well, there could be many reasons. One of them is user login module. Every time user signs or logging into a site, the website wants to verify user credentials before letting user access various modules and parts of the websites.

One of the best practice is to have a separate login verification PHP page e.g. login_check.php that connects to the database, verifies user credentials and then redirects user back to the original page the user was in. Let’s assume original page was where user is in.

We’ll show you how to accomplish the functionality above.

Continue reading