note 115303 deleted from function.require-once by salathe
| From: | salathe@php.net | Date: | Thu, 03 Jul 2014 08:26:32 +0000 |
| Subject: | note 115303 deleted from function.require-once by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199819@lists.php.net to get a copy of this message | ||
Note Submitter: bomdia bomdia dot the dot troll at gmail dot com
----
i have created a simple function to multi require once
function mrequire($array){
//if it isn't an array require_once as string
if(!is_array($array)){
require_once($array);
}else{
//else it count the lenght of array and do a for to require_once all the value of an array
$lenght=count($array);
for($i=0;;$i++){
if($lenght==$i){break;}
require_once($array[$i]);
}
}
}
//example of use
mrequire(["aclass.php","secondclass.php"]);
mrequire("thisisuseless.php");