- How to read couple of numerical data from a file and assing them to some parameters?
- $file_contents = file_get_contents("text.txt");
- foreach(preg_split("/((r?n)|(rn?))/", $file_contents) as $line){
- $arr = explode(" ", $line);
- if(is_numeric($arr[0])) {
- // set needed variables
- $a = $arr[0];
- $b = $arr[1];
- $c = $arr[2];
- }
- }