0

I am trying to get php's namespace technique down but having some issues here:

Why can I not call the method testA from class B? Also I would like to add that I am using 5.3.

in lib ->

<?php
namespace lib;

class A{

        public static function testA(){

                  echo "I am inside A";
        }
 }

in root dir ->

<?php

class B{

    public function showSomething(){
               lib\A::testA();
    } 

 $test = new B();
 $test->showSomething();
1
  • have you included the lib\a.php file in b.php? Commented Jun 22, 2012 at 18:55

2 Answers 2

1

Using namespace you only encapsulate item but not include it. I can't see including of the class file. Include it or use autoload.

Sign up to request clarification or add additional context in comments.

Comments

0

Make sure you're including the file that holds your class A.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.