Question: I am Developing a code using php . In which I am importing two files (header.php and footer.php) in another php file index.php. 
 Now I want that header.php and footer.php should be fixed while scrolling horizontally. can you suggest me the code. I am using the following code 

```
Header.php
 code here
footer.php
code here 

```

index.php

```
<?php include("header.php"); ?>
 welcome to index file 
 welcome to index file 
 welcome to index file 

<?php include("footer.php"); ?>

```

In this file index.php, I want that header and footer should be fixed while scrolling horizontally and others css should also not be disturbed.

Answer: 
Try this

```
<?php
    $dir = 'apps/';
    $result = array();

    if (is_dir($dir)) {
            $iterator = new RecursiveDirectoryIterator($dir);
            foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {                    
                if (!$file->isFile()) {
                    $path = $file->getPath();
                    if(in_array($path, $result))  {
                        continue ;
                    }
                    $result = $path."<br>";
                    echo $result;
                }
            }
    }
?>

```
You can use hash array for checking if path already in list

```
<?php
    $dir = 'apps/';
    $result = array();
    $hash=array();

    if (is_dir($dir)) {
            $iterator = new RecursiveDirectoryIterator($dir);
            foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {                    
                if (!$file->isFile()) {
                    $path = $file->getPath();
                    if(isset($hash[$path]))  {
                        continue ;
                    }
                     $hash[$path]=1;
                    $result[] = $path;
                    echo $path."<br>";
                }
            }
    }
?>

```