File Name
cars-lights-neon-1920x1080.jpg
cars-lights-neon-3840x2160.jpg
cars-lights-neon-800x600.jpg
What I Need is
cars-lights-neon.jpg
What I Tried
$name="cars-lights-neon-1920x1080.jpg";
$newname = substr($name, 0, -4); //removing.jpg
// Real name
$rev= strrev("$newname"); // outputs "0801x0291-noen-sthgil-srac"
$revok= strstr($rev, '-'); //outputs "-noen-sthgil-srac"
$neutral = strrev("$revok"); //outputs "cars-lights-neon-"
$neutral = substr($neutral, 0, -1); //outputs "cars-lights-neon"
$filename = $neutral.".jpg"; //outputs "cars-lights-neon.jpg";
This Code Also Works fine.. But it can be done in Simple steps..So What i am Asking is for better code..
//File Name and Resolution is coming from database so it is not same every time.. Thnx