> I'm loading a set of txt files into a DB. The first 7 lines of each file
> are useless to me...
> I want some way I can always jump those 7 lines... I tought of doing a
> little function like jumpfirstsevenrows(array), but then I'd have to pass
> the whole array as parameter and that can get real memory consuming for
> such a small task. I'll have arrays with more than 100.000 lines...

I think you can still use:
function skip7 (&$array){
  for ($i = 0; $i < 7; $i++, next($array));
}

The & should keep the array from being pushed on the stack, or at least it
did in PHP3.

I'm afraid & got rather more complicated in PHP4, so I'm not 100% sure
*what* it would do.

> since there are pointers in PHP, I'm lost... I don't wanna have to get the
> same 'for bla bla bla code' in each and every function that processes this
> file (there is one function per file, more then 20 overall)...

Another possiblity would be to write a function to first figure out where
the 8th line started, and then use fopen/fseek/fread to always skip to that
byte in the file and then start returning lines from there.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to