I need to include a reference to another php file example.php several times throughout the code, but i get "PHP Fatal error: Cannot redeclare class error."
<?php include 'example.php'; ?>
How to accomplish this?
I need to include a reference to another php file example.php several times throughout the code, but i get "PHP Fatal error: Cannot redeclare class error."
<?php include 'example.php'; ?>
How to accomplish this?
Change it to:
<?php include_once 'example.php'; ?>
If your example.php includes a class and other code, separate it into one file for the class, and the other file for the code you want to execute multiple times. Then in the page where you call the above code, you could write:
<?php include_once 'exampleClass.php'; ?>
<?php include 'exampleCode.php'; ?>
<?php include 'exampleCode.php'; ?>