First release here in Coders' Paradise, but this was a pretty cool thing I just made, and I really didn't think it would work, but it actually did.
This will allow you to place multiple files inside an array, and class names inside another array. Using foreach, it'll grab all the files, include them, then initialize all classes needed to be initialized in the array.
Code:
PHP Code:<?php
$IncludeFiles = array("class.mysql.php", "class.user.php");
foreach($IncludeFiles AS $File)
require_once($File);
$InitClass = array("SQL", "User");
foreach($InitClass AS $Class)
${$Class} = new $Class();
echo $User->say("Hi <br/>");
echo $SQL->Count("select * from mysql.user");
?>
Proof of Concept:
Screenshot by Lightshot
Enjoy
-BGxApixen



Reply With Quote![[PHP] Include files and Initialize all classes in just a few lines!](http://ragezone.com/hyper728.png)


