anyone else have problems using array_search to seek in arrays created by file()?
I have tried creating my own array and I had no problems getting the correct location of the first instance, however when I used a file() array, it fails.
The file in question isn't the problem. To test this I used a file that I successfully loaded just before, and printed the output. file() is reading the file, but array_search does not seem to work with that array. Other arrays seem to work fine.
Problems with array_search and file()
Moderator: General Moderators
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
I'm trying to find a way to find the first instance of a certain string pattern, such as "####" in a file.
I can get the file contents easily with file(), but is there a way that I can change that array to work with array_search, or use some other method to get a line from a file one by one to process?
I can get the file contents easily with file(), but is there a way that I can change that array to work with array_search, or use some other method to get a line from a file one by one to process?