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

  • Home
  • SEARCH
  • 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 6326721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:08:40+00:00 2026-05-24T17:08:40+00:00

I was messing around with some PHP codes and found this which baffles me

  • 0

I was messing around with some PHP codes and found this which baffles me

DisplayButton($width, $name, $url, $judge);

public function DisplayButton($width, $name, $url, $active = true)
{
if ($active)
{
  echo "<td width ='$width%'>
        <a href ='$url'>
        <img src ='s-logo.gif' alt ='$name' border ='0' /></a>
        <a href ='$url'><span class='menu'>$name</span></a></td>";
}  
else
{
  echo "<td width ='$width%'>
        <img src ='side-logo.gif'>
        <span class='menu'>$name</span></td>";
}  
}

how could you define a parameter like $active=true in this case, because as I believe that the value of the passed boolean variable $judge(either true or false) is going to be forced to change to true because of the $active= true, so how could it possibly reach to the else statement? I probably misunderstood the argument $active=true, but how? Thank you very much

  • 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-24T17:08:41+00:00Added an answer on May 24, 2026 at 5:08 pm

    Pass false, not true to reach that else block

    $active = true at function declaration means that parameter is optional, so you can omit it while call the function. But if you pass it, then default value doesn’t affect in any way.

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

Sidebar

Related Questions

I've been writing a parser for PHP and while messing around with some third-party
I'm messing around with some C code using floats, and I'm getting 1.#INF00, -1.#IND00
I am currently messing around with some stuff for an idea for a site
I'm messing around with some windows functions using p/invoke. Occasionally, I get an error
The situation is that I've spent some time messing around with some experimental code.
I have finally started messing around with creating some apps that work with RESTful
I have been messing around with writing some stored procedures in .NET code with
I was messing around with RhinoMocks this morning and couldn't run my tests because
I've been messing around with some x86 assembly as its come up in a
Just got an Arduino and I'm messing around having some problems with the lights.

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.