3v4l.org

run code in 300+ PHP versions simultaneously
<?php if ( ! isset( $spl_autoloaders ) ) { $spl_autoloaders = array(); } if ( ! function_exists( 'spl_autoload_register' ) ): var_dump( 'using polyfill' ); /** * Autoloader compatibility callback. * * @param string $classname Class to attempt autoloading. */ function __autoload( $classname ) { global $spl_autoloaders; foreach ( $spl_autoloaders as $autoloader ) { call_user_func( $autoloader, $classname ); // If it has been autoloaded, stop processing. if ( class_exists( $classname, false ) ) { return; } } } /** * Register a function to be autoloaded. * * @param callable $autoload_function The function to register. * @param boolean $throw Should the function throw an exception if the function isn't callable? * @param boolean $prepend Should we prepend the function to the stack? */ function spl_autoload_register( $autoload_function, $throw = true, $prepend = false ) { if ( $throw && ! is_callable( $autoload_function ) ) { // String not translated to match PHP core. throw new Exception( 'Function not callable' ); } global $spl_autoloaders; // Don't allow multiple registration. if ( in_array( $autoload_function, $spl_autoloaders ) ) { return; } if ( $prepend ) { array_unshift( $spl_autoloaders, $autoload_function ); } else { $spl_autoloaders[] = $autoload_function; } } /** * Unregister an autoloader function. * * @param callable $function The function to unregister. * @return boolean True if the function was unregistered, false if it could not be. */ function spl_autoload_unregister( $function ) { global $spl_autoloaders; foreach ( $spl_autoloaders as &$autoloader ) { if ( $autoloader === $function ) { unset( $autoloader ); return true; } } return false; } /** * Get the registered autoloader functions. * * @return array List of autoloader functions. */ function spl_autoload_functions() { return $GLOBALS['spl_autoloaders']; } endif; function my_autoloader( $class ) { $path = str_replace( '_', '-', $class ); $path = 'class-' . strtolower( $path ) . '.php'; var_dump( $path ); } spl_autoload_register( 'my_autoloader' ); spl_autoload_register( 'my_autoloader' ); function my_autoloader2( $class ) { $path = str_replace( '_', '/', $class ); $path = 'inc/' . $path . '.php'; var_dump( $path ); } spl_autoload_register( 'my_autoloader2' ); var_dump( class_exists( 'YOLO' ) );

This is an error 404

There are `0` results


preferences:
157.47 ms | 1399 KiB | 7 Q