Forum Moderators: coopster
$lines = file('coordinates.txt');
foreach ($lines as $idx => $line) {
$data = preg_match_all('/ *(\d+) *-> *(\d+) *\,?/', $line, $m);
$xArr = $m[1];
$yArr = $m[2];
//$xArr and $yArr are now filled with x & y coordinates
//do what you will with them...
//....
}
1 -> 2,2->4, 3->15,4->0,5->10,6->2
1->4,2->7,3->4,4->10,5->12,6->6,7->10,8->3
1->3,2->1,3->5,4->10,5->3,6->9