# opcache-manager/3.3.0/includes/libraries/autoload.php

OPcache Manager, version 3.3.0. 33 lines.

- Page: https://pluginprobe.com/plugins/opcache-manager/3.3.0/code/includes/libraries/autoload.php
- Raw: https://pluginprobe.com/plugins/opcache-manager/3.3.0/raw/includes/libraries/autoload.php
- Modified: 2019-11-20T13:11:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/opcache-manager/3.3.0/code/includes/libraries/autoload.php#L10-L20`.

```php
<?php
/**
 * Libraries autoload for OPcache Manager.
 *
 * @package Libraries
 * @author  Pierre Lannoy <https://pierre.lannoy.fr/>.
 * @since   1.0.0
 */

spl_autoload_register(
	function ( $class ) {
		$file = '';
		foreach ( OPcacheManager\Library\Libraries::get_psr4() as $library ) {
			$len = strlen( $library['prefix'] );
			if ( strncmp( $library['prefix'], $class, $len ) === 0 ) {
				$file = $library['base'] . str_replace( '\\', '/', substr( $class, $len ) ) . '.php';
			}
		}
		if ( '' === $file ) {
			foreach ( OPcacheManager\Library\Libraries::get_mono() as $library ) {
				if ( $library['detect'] === $class ) {
					$file = $library['base'] . $library['detect'] . '.php';
				}
			}
		}
		if ( '' !== $file ) {
			if ( file_exists( $file ) ) {
				include_once $file;
			}
		}
	}
);

```
