<?php // inside index.php $extra_scripts = ['file03.js']; ?> // now moving into header.php <?php $import_scripts = array_merge(array( 'file01.js', 'file02.js' ), $extra_scripts ?? []); ?> <!DOCTYPE html> <html> <head> <!-- Scripts Section --> <?php foreach ($import_scripts as $script) { echo '<script src="' . $script . '"></script>' . PHP_EOL; } ?><title>Demo</title> </head> <body> <p>Blog</p>
You have javascript disabled. You will not be able to edit any code.