Hi all I've a problem with include function in php:

I have 4 file:

```
dir1/file1.php
dir4/dir2/file2.php
dir3/file3.php
dir3/file4.php

```

In file1.php I have:

```
include_once('../dir3/file3.php');

```

In file3.php I have:

```
required('../dir3/file4.php');

```

In file2.php I want write:

```
include_once('../../dir3/file3.php');

```

but the required function in file3 doesn't work because the path of file4 must be 

```
../../dir3/file4.php 

```

and not 

```
../dir3/file4.php

```

How can I fix it?
['https://Stackoverflow.com/questions/28478191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3297525/']
You can use only dot (.) before your filename which will find that file from root of dir..for eg `./dir3/file4.php` but it increase the overhead..Another way is to use 

```
$base = __DIR__ . '/../';

require_once $base.'_include/file1.php';

```
If you are calling file3 from file2 you will have to go back 2 directories. The best way is using the full path like :

```
home/mysite/public_html/dir3/file3.php

```

It maybe (is) troublesome but good uptill some level.
Edit: **DIR** and rest is also handy, depending on your need