I have a directory structure as follows:
- test
- scripts
- testClasses.php
- testSubDirectory
- otherSubDirectory
- include1.php
- include2.php
- includeTest.php
- otherSubDirectory
- scripts
Here is the code for each file:
testClasses.php:
<?php
echo __FILE__."<br/>";
include1.php:
<?php
include_once("include2.php");
include_once $_SERVER['DOCUMENT_ROOT'] . "/test/scripts/testClasses.php";
incude2.php:
<?php
include_once("/test/scripts/testClasses.php");
includeTest.php:
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/TEST/scripts/testClasses.php");
include_once("include1.php");
var_dump(get_included_files());
var_dump(get_include_path());
var_dump(__FILE__);
echo "PHP Version: ".phpversion().PHP_EOL;
When running PHP 5.4.3 I see the following output: PHP 5.4.3 output
When running PHP 7.4.8 I see the following output: PHP 7.4.8 output
Both servers are running on Windows machines.
The testClass.php file is included twice on the PHP 7.4.8 version due to the include having a different case on both even though it is the same file in the same directory. If testClass.php had some class declarations, an error would be thrown. Is there a way to get around this so I don't have to change the case in my include statements throughout the code?