Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

autoloading classes

improved version : 
<?php
spl_autoload_register(function($className) {
	$file = __DIR__ . '' . $className . '.php';
	$file = str_replace('', DIRECTORY_SEPARATOR, $file);
	if (file_exists($file)) {
		include $file;
	}
});
 
PREVIOUS NEXT
Tagged: #autoloading #classes
ADD COMMENT
Topic
Name
3+4 =