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

The Archive Base Latest Questions

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

EDIT: I believe my confusion is probably created by this code at the top

  • 0

EDIT: I believe my confusion is probably created by this code at the top of the page in which I’m testing for the value of the option… This creates a shortcut method to refer to the option without using the get_option(‘option’) method…

global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { 
        $$value['id'] = $value['std']; 
    } else { 
        $$value['id'] = get_settings( $value['id'] );
    }
}

And so when I set the value of a variable, $myvar, via a checkbox checked in my theme’s options panel and click save, then view my options.php in worpdress, the value of the variable is

true

And when I do a lookup on this variable using

if($myvar == "true")

It passes.

However, when I set the value directly via the update_options() method, like so…

$mvar = true;
update_option('myvar', $myvar);

The value changes from true to 1

And when I do the same comparison as before, if($myvar == “true”), it now fails. It is no longer “true”.

What am I missing? (1) why is “true” and 1, not evaluating the same and (2) What is the update_option method doing to the value of myvar to change the value from true to 1?

  • 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-13T20:07:45+00:00Added an answer on May 13, 2026 at 8:07 pm

    Try

    if($myvar == true)
    

    and

    $myvar = true;
    

    TRUE and FALSE are PHP’s built in boolean variables which are much more universal than a true string.


    About the update_option. It might not be that the option is changing it to 1. Instead it might be that the when it is inserting it into the database, it inserts it as the string "true". Then, when it comes back it is converted to the boolean value true, which when printed is 1

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

Sidebar

Related Questions

THIRD EDIT: I now believe that this problem is due to a SOAP version
When you enter edit mode for a UITableView (grouped but I believe this applies
Edit I believe this is a issue with I am using windows 7 and
--EDIT-- I believe this is a valid question that may have multiple answers (as
EDIT: Updated 21/09/12 for my own sanity... I can't believe this was ever a
EDIT : I believe its safe to say that Flash is finally being discontinued.
EDIT: OK, I believe the following solutions are valid: Use the jQuery AOP plugin.
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
I am stuck on this problem which I am studying for an exam tomorrow.
EDIT NOTE I am rewording this question entirely now that I have a bit

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.