|
|
#1 |
|
New Member
![]() Join Date: Nov 2010
Posts: 1
|
What i want it to do is to find all the lines that contains a row of numbers.
In this case no less then 4 numbers after etche other. This is the code i got and it displays a blank page when the file contains 1234 in a line in the .txt file. tryd using it .rtf as well same result blank page. Here is the Code: <?php // the file has been uploaded. // (do it yourself) $file = 'file.txt'; // the minimum length of each number $min = 4; $matches = array (); foreach (file ($file) as $k => $line) { if (preg_match ('/^[\d]{' . $min . ',}+$/', $line)) { $matches[] = $k; } } if (sizeof ($matches)) { // dumps line numbers with positive match print_r ($matches); } ?> All help is most welcome. Sorry if my gramma isent perfect i hawe some problems white spelling. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|