Remove Path from PHP String front and back
Get the solution ↓↓↓Solution:
You can explode on "/" and then find the last undescore from the last item and substring it.
$str = "/usr/local/EDI/GTNexus/BookingConfirmation/test/PROCESSED/ELITESGGTN_30120180814_1410366355.XML_20180817135443";
$arr = explode("/", $str);
$name = substr(end($arr), 0, strrpos(end($arr), "_"));
echo $name; //ELITESGGTN_30120180814_1410366355.XML
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: ftp_put(): can't open that file: no such file or directory
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.