Has file API changed?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
firemyst
Forum Newbie
Posts: 6
Joined: Sat Feb 01, 2003 5:33 pm

Has file API changed?

Post by firemyst »

Hi everyone,

I have some PHP code which looked like:

Code: Select all

if (file_exists($file) && $fp = file ($file, "r")) {
and noticed there are several code tutorials floating about the net like that.

However, then I downloaded and installed PHP version 5.2.1 and it complains:



Warning: file() expects parameter 2 to be long, string given in C:\Inetpub\wwwroot\common.php on line 675


Looking up the documentation, I see the "file" function has changed, but could not find it in any of the change logs.

When did it change and why?

Doing a google on the error, I see I'm not the only one who's been caught by this.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The file() function hasn't really changed since it's inception. I think you're confusing it with fopen().
Post Reply