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 7511165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:27:49+00:00 2026-05-29T23:27:49+00:00

Oh well, maybe it’s my ignorance, but PHP documentation about include statement says take

  • 0

Oh well, maybe it’s my ignorance, but PHP documentation about include statement says take care when comparing return value:

<?php
// won't work, evaluated as include(('vars.php') == 'OK'), i.e. include('')
if (include('vars.php') == 'OK') {
    echo 'OK';
}

// works
if ((include 'vars.php') == 'OK') {
    echo 'OK';
}
?>

But this is what i’ve experienced; boolean false in case of fail, int 1 if success:

$exists = 'Found.php';
var_dump((include $exists)); // Type is: int, value is: 1

$notexists = 'NotFound.php';
var_dump((include $notexists)); // Type is: boolean, value is: false

Is this my bad? Why returning value is inconsistent (meaning not always boolean, for example) and differs from PHP documentation?

  • 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-29T23:27:50+00:00Added an answer on May 29, 2026 at 11:27 pm

    Well this is exactly what the documentation states:

    $bar is the value 1 because the include was successful. …
    If the file can’t be included, FALSE is returned and E_WARNING is issued.

    When it becomes inconsistent is when you actually return something in the included file,
    e.g. in Found.php:

    <?php
    return 'Returned from Found.php';
    

    And then

    include 'Found.php'; // -> Returns "Returned from Found.php"
    

    It is also worth reading up on how booleans evaluate in PHP:

    http://php.net/manual/en/language.types.boolean.php

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

Sidebar

Related Questions

Well, maybe it is a stupid question, but I cannot resolve this problem. In
Maybe I just don't know .NET well enough yet, but I have yet to
I remember reading a law (well, maybe not exactly a law), but in software
Well. I'm working on an IDE. Some of you maybe saw a post about
Well I was curious about this and searched for a while but couldn't find
Well maybe this is not the best title; but it's hard to convey my
Tried searching online, but seems that nobody use ew:calendarpopup on .NET? Maybe deprecated? Well,
Well, maybe a odd question, but how would I handle unhandled exceptions only from
Well, question maybe doesn't correct, but I give a shoot. My script: <a href=javascript:var%20u=location.href;window.open('http://localhost/url='+u);void(o)
In .NET (at least in the 2008 version, and maybe in 2005 as well),

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.