I don't understand why my machine running PHP 7.2.9 gives this error:
Fatal error: Cannot declare class Error, because the name is already in use in controllers\error.php on line 3
I have a file named controllers/error.php which contains:
<?php
class Error {
function __construct() {
echo 'Error: 404 not found the file.';
}
}
Meanwhile, I have a file named /index.php which contains:
require "controllers/error.php";
$controller = new Error;
Even if I change from require to require_once "controllers/error.php", it still keeping reporting the same message.