<?php $fn = '../../../filename.txt';$fn_parts = (array_reverse(explode("../", $fn)));echo "../" . $fn_parts[0]; ?>
Standard input is empty
../filename.txt
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!