ErcFrtz Posted December 2, 2008 Share Posted December 2, 2008 Does anyone know of an easy way to parse a string that was entered via a textbox? Let's say the user enters "1, 2, 3, 4, 5" How can I parse out the numbers? I can't use the substr() function because the numbers or parts between the commas will change. Is there anyway to get something to recognize the comma and grab what's before (or after) it? Thanks. Link to comment https://forums.phpfreaks.com/topic/135186-solved-string-parsing/ Share on other sites More sharing options...
unkwntech Posted December 2, 2008 Share Posted December 2, 2008 $item = '1, 2, 3, 4, 5, 6, 7, 8, 9'; $items = explode(',', $item); $items will be an array with each number in it. edit: no regex needed Link to comment https://forums.phpfreaks.com/topic/135186-solved-string-parsing/#findComment-704073 Share on other sites More sharing options...
ErcFrtz Posted December 2, 2008 Author Share Posted December 2, 2008 Thanks!! Link to comment https://forums.phpfreaks.com/topic/135186-solved-string-parsing/#findComment-704095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.