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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:07:14+00:00 2026-05-13T13:07:14+00:00

I am just studying other user’s PHP code right now to understand and learn

  • 0

I am just studying other user’s PHP code right now to understand and learn better. In the code below, it is part of a user class. When I code using if/else blocks I format them like this…

if(!$this->isLoggedIn()){
    //do stuff
}

But in the code below it is more like this

if (! $this->isLoggedIn())
    return false;

Also in the function below you can see that there is a couple times that there can be a RETURN value. SO my question here, when RETURN is called, does it not run any code after that? Like does it end the script for that function there?

In this case if this is ran…

if (! $this->isLoggedIn())
        return false;

Does it continue to run the code below that?


Here is the function

<?PHP
private function logout($redir=true)
{
    if (! $this->isLoggedIn())
        return false;

    $this->obj->session->sess_destroy();

    if ($this->isCookieLoggedIn())
    {
        setcookie('user','', time()-36000, '/');
        setcookie('pass','', time()-36000, '/');
    }
    if (! $redir)
        return;

    header('location: '.$this->homePageUrl);
    die;
}
?>
  • 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-13T13:07:14+00:00Added an answer on May 13, 2026 at 1:07 pm

    Yes.

    When PHP sees a return command, it stops executing and returns it to whatever called it. This includes includes, function executions, method execution, etc.

    In the following, ‘Test’ will never echo:

    $test = "test";
    return;
    echo $test;
    

    If you are in an included file, return will stop its execution, and the file that included it will finish executing.

    One of the use cases is similar to what you described:

    public function echoString($string)
    {
        if(!is_string($string))
        {
            return;
        }
        echo $string;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 291k
  • Answers 291k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Think about how you'd model the operations in OO design:… May 13, 2026 at 5:59 pm
  • Editorial Team
    Editorial Team added an answer In short, no. Flash Player 9 doesn't allow access to… May 13, 2026 at 5:59 pm
  • Editorial Team
    Editorial Team added an answer Ok, found it now: $(Inherit) is what I want, as… May 13, 2026 at 5:59 pm

Related Questions

I've been working on laying out the data structure for an application I'm working
I'm working on a star schema for analysis of posted form data. The site
I want to expand on the functionality of NSTextField. AMong the things I want
I have spent 1 week studying objective C. Now I am quite confused at
I know this may seem like a common question on SO but I could

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.