Code:
```php
<?php
$pattern1 = '/[^[:print:]]+/'; // remove non-printable characters
$pattern2 = '/[ \t]+$/';  // remove whitespace at end of string
$pattern3 = '/^[ \t]+/';  // remove whitespace at beginning of string
$pattern4 = '/^[\\\\|\/]+/'; // remove leading slash if one exists
$pattern5 = '/^[\.\.\/|\.\.\\\\]+/'; // remove all ../ and all ..\ if any exist

echo "Welcome";
$data = $_GET['file'];
if (!preg_match($pattern1, $data)){
	if (!preg_match($pattern2, $data)){
		if (!preg_match($pattern3, $data)){
			if (!preg_match($pattern4, $data)){
				if (!preg_match($pattern5, $data)){
					echo file_get_contents($data);
				}
			}
		}
	}
}

?>
```
Payload:  
`http://localhost:8080/php.php?file=php://filter/tmp/resource=/etc/passwd` 

Letme explain: First i used `php://` wrapper which is php specific and commonly used in CTFs. Secondly, it doesnt start with space or end with space or start with `/`, so i bypassed 2,3,4 condition. It has all printable characters so bypassed 1 condition. Finally i didnt used `../` which is used in relative traversal, i used absolute path.  

Note:
I am not sure if I used preg_match correctly or something else, please correct me if i did something wrong. 
Screenshot:  
[![Payloaded etcpasswd][1]][1]


  [1]: https://i.sstatic.net/nSiek.png