I have a helper function helper.php with contents:
<?php
session_start();
function get_result($dbh, $sql) {
//return mssql_query($sql);
return $dbh->query($sql);
}
?>
which is included in two files (information.php and commercial.php) using:
include_once 'helper.php'
Unfortunately this generates the slightly confusing error message:
PHP Fatal error: Cannot redeclare get_result() (previously declared in helper.php:4) in helper.php on line 4
I understand that i cannot redeclare functions, hence why i use the include_once construct, but nevertheless it tries to redeclare the function anyway. Why?
If it helps; I am using Mustache PHP, and all three files are located in the partials folder.