If you are complex issue in PHP and you do not have debugger install or do not want to use debugger, there is an easy way to troubleshoot your code.
Place die(); function right at the point where you want to troublesheet/example values. The program will stop at that point and you see your values.
Example of Using Die
You have a query that is returning unsuspected result. There is no way you can debug the code directly or you can’t output the content because the page redirects. In this case use die();
$query = "select * from mytable where id='$id'"; echo $query; die();
The execution will stop at this point and you can examine your query.