Script PHP to write include "index.php" in each PHP files

Job ID: 31040550

Budget: €8 – €30 EUR

Hi,

I want a script in PHP allowing to insert in all the PHP files of a folder the line: include 'index.php'

And depending on where the .php file is located it must adapt

include 'index.php'
or
include '../index.php'
or
include '../../index.php'
etc

Depending on where the other files are
Thanks