Classes within classes in PHP
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-06-17T14:32:47Z
Indexed on
2010/06/17
14:43 UTC
Read the original article
Hit count: 211
Can you do this in PHP? I've heard conflicting opinions:
Something like:
Class bar {
function a_function () { echo "hi!"; }
}
Class foo {
public $bar;
function __construct() {
$this->bar = new bar();
}
}
$x = new foo();
$x->bar->a_function();
Will this echo "hi!" or not?
© Stack Overflow or respective owner