Question: I received the following error:

```
[27-Apr-2009 10:26:06] PHP Fatal error:  Cannot redeclare alphanumeric() (previously declared in /home/iddoc/public_html/lib/common.php:6) in /home/iddoc/public_html/lib/common.php on line 8

```

Notice this:

```
/home/iddoc/public_html/lib/common.php:6) in 
/home/iddoc/public_html/lib/common.php on line 8

```

Here are the offending lines:

```
function alphanumeric($str) {
    return strtolower(preg_replace("/[^A-Za-z0-9]/",'',$str));
}

```

Prior to these lines there are only comments. There is no other declaration of that function anywhere else in that file or any other.

Strange, no?

Answer: 
You should always use include\_once or require\_once when including code files in PHP. There are exceptions to this rule but if you aren't sure, use the \_once versions. The only time it is okay to use include or require is when you know the file will never, ever be included again in the same program OR the file being included does not declare functions (without protecting them with an if (function\_exists()) {} block).

As an example, templating system are one of the very few uses where you probably don't want the \_once version.
Check for recursive includes and make sure your blocks are not executed several times.