I am having a love-hate relationship with PHP:mad:
My code organization was as follows:
class First
{
someMethod()
{
calls a method in class second, say method();
}
}
class Collection //implements IteratorAggregate
{
//I wanted this to be iterable.
}
class Second
{
method()
{
//Collection instance is being instantized here.
}
}
The above organization worked fine. Notice Coolection is not iterable yet.
When I uncomment //implements...,
now the parser starts emitting out Class 'Collection' not found.
If you say, that the definition of Collection has not yet been parsed, then why is it working when the class is not Iterable???
Shifting Collection to the top of the file, & then uncommenting the //implements..
clause finally made evrything work.
I mean this is real madness. It almost drived me nuts..
Is this a bug with PHP???