tcjohans Posted October 1, 2007 Share Posted October 1, 2007 I am looking for a way to random-access text files from a PHP-based script. I don't think PHP itself has any functions that can do this. But are there any other solutions, e.g. using Python, Perl, etc. and somehow interact with PHP?? Or some other way??? Any suggestions welcome... By the way, are there any fundamental reasons why PHP should not be able to do this or is it just that no one still has developed the necessary PHP library/extension?? Thomas Quote Link to comment https://forums.phpfreaks.com/topic/71314-how-to-random-access-files-with-php/ Share on other sites More sharing options...
tcjohans Posted October 1, 2007 Author Share Posted October 1, 2007 I found this reply at some forum from 2003 to this very issue: ----- In order to uses random access, you should, indeed, use fseek(). But then you need to know how how your file looks like, that is, each record must be of either fixed lenght, or each record should store a "pointer" about how long they are. Any file polated with lumps wont do here. Why is this needed? Simply becuase fseek() moves the read head to a certain position in your file, and if you don't know what position you like to go to then fseek() is kind of useless. --------- Quote Link to comment https://forums.phpfreaks.com/topic/71314-how-to-random-access-files-with-php/#findComment-358803 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.