Question: I have a class, its located in `/some/path/Class.php` for example. Now I want to create an object of this class.

I tried that, but it did not work:

```
$obj = new some/path/Class();

```

I also tried to include the class be fore and to create the object the normal way, like this:

```
include('/some/path/Class.php');
$obj = new Class();

```

Throws an error, too. How can I create an object of that class?

Answer: 
Use `dirname(__FILE__) . '/some/path/Class.php'`

where `dirname(__FILE__)` is the path of the file calling this class.
```
include('/some/path/Class.php');

```

This will start looking in the root folder, so you would have to supply the full path to the file which obviously doesn't make sense.

Use something like 

```
dirname(__FILE__)

```

to use a relative path. You might also want to declare a constant in your index.php (or in another file that gets autoloaded) that contains the base path of your application and then use that instead.