No, he's right in this instance, I tried to write PHP4-compatible code but failed. Shame on me. The code for PHP4 is:Code:class Page {
var $title;
var $url;
static $instances = array();
static function get_current() {
foreach(self::$instances as $page)
if($page->url === SITE_URL . $_SERVER['REQUEST_URI'])
return $page;
return false;
}
function Page($title, $url) {
$this->title = $title;
$this->url = $url;
Page::$instances[] = $this;
}
}
define('SITE_URL', 'http://localhost/');
$pages = array(
new Page('Home', SITE_URL),
new Page('News', SITE_URL . '/news.php'),
new Page('Forum', SITE_URL . '/forum')
);
$current_page = Page::get_current();
