What are the potential pitfalls of using arrays in include_once in PHP?

Using arrays in include_once in PHP can lead to unexpected behavior or errors, as include_once expects a string as its parameter. To solve this issue, you can loop through the array and include each file individually using include_once.

$files = ['file1.php', 'file2.php', 'file3.php'];

foreach ($files as $file) {
    include_once $file;
}