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();
?>
Have a second? Check out this great Canadian Health & Living Store based in Toronto

