Jump to content

API Boolean values


Recommended Posts

yes, the internal API is fine. but the external API is not.

i can not send form values such as...

entry1=true&entry2=false&entry3=false

it needs to be: entry1=1&entry2=0&entry3=0

well the true actually works because 1 and "true' both = truth. but 'false' also = truth. So this tells me they are doing a   if value == 1  which is bad programming. it should be if value === boolean truth / false

Link to comment
Share on other sites

$_POST only provides strings, so they would need:

  • A boolean check for if $v === 1 / 0
  • A string check for if $v === "true" / "false"

Also, it is standard PHP to use 1 or 0 in place of booleans but using a string that just says "true" or "false" isn't as far as I know / have seen.

How is giving 1 or 0 limiting?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated