gos1 Posted December 13, 2006 Share Posted December 13, 2006 Hi ; I need to just take all the uıser id's from a CSV file. All the fields are seperated by ";" and in front of the id's there is a line break (a rectangle). Does anyone know how to ? ?? Link to comment https://forums.phpfreaks.com/topic/30469-ereg-or-something-else/ Share on other sites More sharing options...
hitman6003 Posted December 13, 2006 Share Posted December 13, 2006 Use the file and explode functions.http://www.php.net/filehttp://www.php.net/explodeor fgetcsv.http://www.php.net/fgetcsvThe latter has a user provided function that might work for you:http://us2.php.net/manual/en/function.fgetcsv.php#70957 Link to comment https://forums.phpfreaks.com/topic/30469-ereg-or-something-else/#findComment-140404 Share on other sites More sharing options...
gos1 Posted December 13, 2006 Author Share Posted December 13, 2006 but I am trying to just take the id. I mean the algorithm is going to be like : for every line take the value until the first comma and if the value is integer store it in somewhere.. Is it possible ?? Link to comment https://forums.phpfreaks.com/topic/30469-ereg-or-something-else/#findComment-140460 Share on other sites More sharing options...
mainewoods Posted December 13, 2006 Share Posted December 13, 2006 preg_match_all() is what you want:http://www.php.net/manual/en/function.preg-match-all.php--the function returns an array of matches so will do all the work for you but you will have to break the ice with regular expressions--regular expression can look for matches only at the beginnings of lines like you want but you have to set flags to do that. a good online regular expression tutorial I use:http://www.regular-expressions.info/ Link to comment https://forums.phpfreaks.com/topic/30469-ereg-or-something-else/#findComment-140467 Share on other sites More sharing options...
gos1 Posted December 13, 2006 Author Share Posted December 13, 2006 I still cannot find the beginning of the line function ? Does anyone have the code for that ? Link to comment https://forums.phpfreaks.com/topic/30469-ereg-or-something-else/#findComment-140582 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.