What is Autoloading; How do you use spl_autoload, __autoload and spl_autoload_register?

spl_autoload_register() allows you to register multiple functions (or static methods from your own Autoload class) that PHP will put into a stack/queue and call sequentially when a “new Class” is declared. So for example: spl_autoload_register(‘myAutoloader’); function myAutoloader($className) { $path=”/path/to/class/”; include $path.$className.’.php’; } //————————————- $myClass = new MyClass(); In the example above, “MyClass” is the name … Read more

How can I sort arrays and data in PHP?

Basic one dimensional arrays $array = array(3, 5, 2, 8); Applicable sort functions: sort rsort asort arsort natsort natcasesort ksort krsort The difference between those is merely whether key-value associations are kept (the “a” functions), whether it sorts low-to-high or reverse (“r“), whether it sorts values or keys (“k“) and how it compares values (“nat” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)