[PHP-NOTES] note 130360 added to language.oop5.autoload

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
<?php
namespace util;

class Autocarga
{
    public static function registraAutocarga(): void
    {
        
        
        spl_autoload_register([self::class, 'autocarga']);
    }

    public static function autocarga(string $clase): void
    {

        $archivo = __DIR__ . '/../'. str_replace('\\', '/', $clase). '.php';

        if (file_exists($archivo)) {
            require_once $archivo;
        } else {
            
            echo "No existe el archivo $archivo";
        }
    }
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 94.73.34.245)
----
Manual Page -- https://php.net/manual/en/language.oop5.autoload.php
Edit        -- https://main.php.net/note/edit/130360
Del: integrated  -- https://main.php.net/note/delete/130360/integrated
Del: useless     -- https://main.php.net/note/delete/130360/useless
Del: bad code    -- https://main.php.net/note/delete/130360/bad+code
Del: spam        -- https://main.php.net/note/delete/130360/spam
Del: non-english -- https://main.php.net/note/delete/130360/non-english
Del: in docs     -- https://main.php.net/note/delete/130360/in+docs
Del: other reasons-- https://main.php.net/note/delete/130360
Reject      -- https://main.php.net/note/reject/130360
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.