<?php function replaceFileName($input, $newFileName) { $info = pathInfo($input); return $info['dirname'] . DIRECTORY_SEPARATOR . $newFileName . '.' . $info['extension']; } $test = "300.300.300.220:/var/lib/test/data/source/file.txt"; var_dump(replaceFileName($test, 'testing'));
You have javascript disabled. You will not be able to edit any code.