mardi 28 juin 2016

How do I automate php file creation using an array of x names to create x php files each with a different name?

I have an array with x names and need to create x php files each with a different name from my array. My template file is

$cityNames = array("example1", "example2", "example3");

$_SESSION['CITY'] = '#';

and I need to replace # with a name from my array x number of times to create x number of files. So in this example I need my output to be 3 files named

example1.php (where $_SESSION['CITY'] = 'example1';)

example2.php (where $_SESSION['CITY'] = 'example2';)

example3.php (where $_SESSION['CITY'] = 'example3';)

Aucun commentaire:

Enregistrer un commentaire