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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:31:12+00:00 2026-05-29T07:31:12+00:00

I am going through the Head First PHP & MySQL book right now, and

  • 0

I am going through the “Head First PHP & MySQL” book right now, and on many parts of the book there are code snippets used to process HTML forms. They start like this:

if (isset($_POST['submit'])){
...
}

The if clause is used to detect if the form has been submitted already or not. Being used to programming in C mostly, I find that construct redundant and annoying (and I also don’t think it helps code readability for experienced programmers). I would rather write it as:

if ($_POST['submit']){
    ...
}

Question: Is there some other reason to use isset() in this context that I might be missing? Would my version of the snippet be considered non-idiomatic PHP? What about in other contexts, can you give me an example of when isset() might be useful?

  • 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-29T07:31:13+00:00Added an answer on May 29, 2026 at 7:31 am

    There are situations where a variable is NULL, 0, or FALSE. They’d fail the if() {} comparison, but they are set.

    Using isset() also avoids a notice about an undefined variable if your error_reporting settings include E_NOTICEs.

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

Sidebar

Related Questions

I'm going through the Head First C# book and in one of the chapters
I was going through the Programming Interviews Exposed book. There's a code given for
I've been going through Head First Design Patterns (just came in recently) and I
Going through K&R, I'm trying to get my head around C. I want to
I have been going through the book Learning WCF trying to get my head
I'm going through the Pro Git book , trying to get my head around
After going through the Appendix A, C# Coding Style Conventions of the great book
While going through many resources on multithreaded programming, reference to volatile specifier usually comes
Just going through the sample Scala code on Scala website, but encountered an annoying
I was going through the AWDR book on web development with ruby on rails

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.