If you want to use Class B within Class A in PHP, how can you do it? Language Notes PHP
If you want to use one class within another PHP class, you can leverage PHP's class instantiation mechanism to create a new class instance and use it. Suppose you have two classes, A and B, and class A needs to use class B; you can instantiate class B within class A. For example: class A { public function doSomething() { $b = new B(); $b->do... }}