This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
spl_autoload_register(function ($name) { | |
// $exp will be the name of the class without the \with\traitname part => array_splice | |
$exp = explode("\\", $name); | |
// serach from end | |
$index = array_search("with", array_reverse($exp, true)); | |
if (!$index || $index - 1 == count($exp)) // also fail when value is 0 | |
return false; |