bmdsherman Posted September 13, 2009 Share Posted September 13, 2009 I have a variable, $photo, that is equal to 1.jpg, I want to remove the ".jpg" part from the variable so the variable is only "1", does anybody know how I can do that? Link to comment https://forums.phpfreaks.com/topic/174133-solved-remove-part-or-varible/ Share on other sites More sharing options...
.josh Posted September 14, 2009 Share Posted September 14, 2009 $photo = substr($photo,0,-4); echo $photo; or $photo = explode('.',$photo); echo $photo[0]; or preg_match('~^[^.]+~',$photo,$match); echo $match[0]; Link to comment https://forums.phpfreaks.com/topic/174133-solved-remove-part-or-varible/#findComment-917915 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.