David
David

Reputation: 20063

What's the best way to extend classes in php 5.2.17?

In PHP 5.3 you can quite easily write say...

class Controller extends \Special\Controller

Currently I am having to work with php 5.2.17, how do you properly extend classes with this version? I know there aren't any namespaces so I'm curious is it even possible to do this with a version <5.3

Upvotes: 0

Views: 262

Answers (1)

alxbl
alxbl

Reputation: 790

class A
{
    //...
}

class B extends A
{
    //...
}

Namespaces don't change the behaviour of extension, as far as I know... the only difference is that your classes are all in one namespace (the global one) and they can't have the same name.

Upvotes: 4

Related Questions