Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6638323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:25:20+00:00 2026-05-25T23:25:20+00:00

I have just started practicing OOP in php through the book Concepts, Techniques and

  • 0

I have just started practicing OOP in php through the book Concepts, Techniques and Codes. Unluckily I have never worked with directories and files in PHP and feeling difficulty to understand this condition here is the full code

function DirectoryItems($directory){
  $d = "";
  if(is_dir($directory)){
     $d = opendir($directory) or die("Couldn't open directory.");
     while(false !== ($f=readdir($d))){
      if(is_file("$directory/$f")){
      $this->filearray[] = $f;
}
}
closedir($d);
}else{
//error
die("Must pass in a directory.");
}
}

All I can understand is first we check the parameter that is it directory after that we open that directory and than we read the directory and putt all the files in the directory into an array but the condition is confusing me what the heck is !== I know only about !=

This book is written in PHP4 and 5 btw

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:25:21+00:00Added an answer on May 25, 2026 at 11:25 pm

    The !== is like != but in addition to checking the equality it also checks the type.

    This is an important distinction because sometimes something is “falsey” or “truthy” but not really a Boolean type with a value of false or true. The number 0 for example is generally treated as false.

    The second slightly confusing part here is that the code is checking false !== (assignment) in the while loop. This is basically checking if the assignment was for a valid value.

    So to out it all together code:

    while(false !== ($f=readdir($d))
    

    …translates to something like:

    While $f is assigned an object from readdir($d) do …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started on a xml document just for practicing xslt and I have
I have just started learning coding and PHP so I have been looking at
I have just started learning CXF. I made a maven archetype project through eclipse.
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have just started playing with ASP.NET MVC and have stumbled over the following situation.
I have just started using silverlight 2 beta and cannot find how to or
I have just started using Boost 1.36. These libraries would be very useful in
I have just started learning Erlang and am trying out some Project Euler problems
I have just started to study computer sciences at my university where they teach

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.