Top SEM and SEO Tips    

Typical Lazy PHP Programmer

August 27, 2008 – 4:50 pm

That’s me, write a program and it works, don’t bother initializing variables, etc. That was until I moved to a new host that had display errors turned off. It is pretty much impossible to debug without errors being displayed so I went rummaging around for ways around this and found the following code:

error_reporting(E_ALL);
ini_set(“display_errors”,1);

I turned this on and suddenly the code was spitting out warnings and messages all over the place. Some trivial but some really fixed issues that I didn’t know. Now I’ve got it turned on all the time in development and on internal systems.

As the ‘Practical PHP Programming’ manual says:
Always set your PHP error level to the most verbose level, E_ALL. All too often people don’t realise that PHP is outputting various complaints about variables not being set, etc, which you can just do away with entirely by cleaning up your code.

Related posts:

  1. More on PHP Error Handling OK so I’ve been talking about PHP errors for...
  2. Search Engine Friendly Redirects – Custom 404s There are three articles dealing with redirects to handle,...
  1. 1 Trackback(s)

  2. Dec 1, 2008: Recent Links Tagged With "programmer" - JabberTags

Post a Comment