Thread: !== in php3

    #1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    In a constant state of turmoil
    Posts
    855
    Rep Power
    86

    !== in php3


    I wrote a script a little bit ago that grabs all the .gif and .jpeg files in a directory for an image gallery of sorts. I did it in php4. I just gave it to a friend of mine to use, but he only has php3 available to him and it's kicking up rough about !==.

    Would someone please tell me how to rewrite this piece of code so it will work under php3.

    while (false!==($file = readdir($handle))) {

    I've only been coding since php4 and I have no real idea of the differences.

    Thanks!
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Sweden
    Posts
    25
    Rep Power
    0
    I found this in the User Contributed Notes section under readdir() in the online PHP manual. Since I have no experience with PHP3 I can't tell you if it works.
    With PHP3, I think that the right way would be

    while(is_string($file = readdir($dir)))

    else you would have problems with a file called "0".
    /josa
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    In a constant state of turmoil
    Posts
    855
    Rep Power
    86
    Thanks Josa!

    I'll give it a try and let you know.

IMN logo majestic logo threadwatch logo seochat tools logo