Get most recent modified time of a folder recursively with PHP
Can you please correct me if I am doing anything wrong.


It depends on whether you care for the deleted files or not. If you do, you should also check the modification time for the directory itself, not only files in it. 

The code itself could be also improved:   


you can remove the duplicated condition
which in turn, can be substituted with max() function.
also you can utilize the glob() function that can save you that boring $file == '..' condition, as well as other unnecessary code.


So in the end the code could be

function get_m_time_dir ($directory)
{
    $last_modified_time = 0;
    $dirmtime = filemtime ($directory);
    foreach (glob("$directory/*") as $file)
    {
        if (is_file ($file))
        {
            $filemtime = filemtime ($file);
        } else {
            $filemtime = get_m_time_dir ($file);
        }
        $last_modified_time = max($filemtime, $dirmtime, $last_modified_time);
    }
    return $last_modified_time;
}