> But I was wondering if anyone could enlighten me as to why php would
> be upset interpreting the constant as the class name.  Thanks.

class Foo {
  function get_name() { return 'Foo'; }
}

class Bar {
  function get_name() { return 'Bar'; }
}

define('Foo', 'Bar');

$C = new Foo();
echo $C->get_name();
// output: Foo
// you might have been expecting: Bar

This "issue" also affects static method calls:
Foo::get_name();
// returns: Foo
// even though Foo (the constant) resolves to: Bar

HTH.

S

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to