O'Reilly logo

PHP Programming with PEAR by Stoyan Stefanov, Carsten Lucke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

MDB2 Modules

When looking at some of the examples earlier in this chapter, you've already seen how the idea of modularity is built into MDB2. The main purpose is to keep the base functionality lightweight and then include more functionality on demand, using the loadModule() method.

Earlier in the chapter, the Extended module was loaded like this:

$mdb2->loadModule('Extended');

After this call you have access to all the methods that the Extended module provides, such as all the get*() methods. The methods are accessible through the extended property of the $mdb2 instance:

$mdb2->extended->getAssoc($sql);

In addition to that, in PHP5, due to the object overloading functionality, you can access the methods directly as methods of the $mdb2 instance: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required