mallen
-
Posts
316 -
Joined
-
Last visited
Community Answers
-
mallen's post in using Strrchr to get end of string was marked as the answer
$THEURL = "SELECT Image_URL From ... ect";//the query
$image = $wpdb->get_row($THEURL, ARRAY_A);//the variable is dynamic
var_dump(substr(strrchr($image,'/'),1)); fails
var_dump(substr(strrchr('http://somewebsite.com/images/image1.jpg','/'),1)); gives 'image1.jpg'
var_dump($image); // gives 'http://somewebsite.com/images/image1.jpg'
I figured it out:
var_dump(substr(strrchr($image['Image_URL'],'/'),1));