PHP: Including scripts from within class functions

This surprised me today: Using PHP you can include scripts from within a class functions and access the included functions globally. It seems to go against what I feel should occur, but it works perfectly fine. I posted on a discussion forum at devshed to see if anyone has some insight into this.

temp_include.php:

Code:
<?php

function test_funct() {
    echo "function called";
}

?>

Main script:

Code:
<?php

Class ABC {
    public function __construct() {
        require_once 'temp_include.php';
    }
}

$o = new ABC();
test_funct();

?>

Related Articles:

Have a second? Check out this great Canadian Health & Living Store based in Toronto

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>