I have “requests” in a database from which I need to extract the name of the image – it will always be a .jpg but the number of characters in the name could vary, so I am shying away from substr().
The value looks like this “Added 545_4.jpg to Photo Album, The British Open”.
The “Added” will always be there and the “to Photo Album, ” will always be there but the name of the album differs.
Based on the manual I guessed that the % character means more than one character, so I tried to get that to represent the variants of photo albums. So, I ended up with this but nothing seemed to happen since it just echoes out the original string.
$emij = str_replace('Added','',
str_replace(' to Photo Album%', '', $thisTask[0]['request']));
echo $emij;
Any help is greatly appreciated.
A regex will work best for this: