nano Posted May 26, 2011 Share Posted May 26, 2011 Hey Guys, I have the following string: 184 - fashion - 4 x 6 Inches - (£2.00) And I am trying to retrieve the 184, using the strrpos() function, it seems to take everything before the last occurrence of '-'.. I thought strrpos() would stop at first occurrence and pass me the 184 Anyone have any ideas how I can pull back just the numbers before the first '-'? Sample: $input1 = strrpos($_POST['product'],"-"); $article = substr($_POST['product'],0,$input1); $article outputs: 184 - fashion - 4 x 6 Inches Cheers Link to comment https://forums.phpfreaks.com/topic/237568-php-strrpos-help/ Share on other sites More sharing options...
nano Posted May 26, 2011 Author Share Posted May 26, 2011 Damn it.. I needed the stripos() not strrpos()... talk about confusing Link to comment https://forums.phpfreaks.com/topic/237568-php-strrpos-help/#findComment-1220808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.