HektoR Posted January 8, 2009 Share Posted January 8, 2009 hello .... i have string like this : 2456982-5135487-233213-5435-767575-12312 how can i get values from beginning to third '-' thank you Link to comment https://forums.phpfreaks.com/topic/139966-solved-get-specify-values-from-string/ Share on other sites More sharing options...
New Coder Posted January 8, 2009 Share Posted January 8, 2009 Is the string length to the third '-' always the same? Link to comment https://forums.phpfreaks.com/topic/139966-solved-get-specify-values-from-string/#findComment-732338 Share on other sites More sharing options...
Mark Baker Posted January 8, 2009 Share Posted January 8, 2009 $strValue = '2456982-5135487-233213-5435-767575-12312'; $strArray = explode('-',$strValue); for ($i = 0; $i < count($strArray), $i++) { echo 'Value '.($i + 1).' is '.$strArray[$i].'<br />'; } Link to comment https://forums.phpfreaks.com/topic/139966-solved-get-specify-values-from-string/#findComment-732344 Share on other sites More sharing options...
HektoR Posted January 9, 2009 Author Share Posted January 9, 2009 it works, thank you Link to comment https://forums.phpfreaks.com/topic/139966-solved-get-specify-values-from-string/#findComment-733152 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.