- substr: documentation ( source)
- var_dump: documentation ( source)
- get_class_methods: documentation ( source)
- method_exists: documentation ( source)
<?php
class A {
public static function init ( $resources = null ) {
if ( ! $resources )
$resources = get_class_methods(__CLASS__);
foreach ( $resources as $method ) {
if ( ! ( substr($method, 0, 5) == '_init' ) )
$method = '_init' . $method;
if ( ! method_exists(__CLASS__, $method))
continue;
self::$method();
}
}
protected static function _initCharset () {
var_dump('Charset');
}
protected static function _initConfig () {
var_dump('Config');
}
protected static function _initDoctrine () {
var_dump('Doctrine');
}
protected static function _initCookie () {
var_dump('Cookie');
}
protected static function _initA () {
var_dump('A');
}
}