vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What is wrong with my PHP? (https://vborg.vbsupport.ru/showthread.php?t=69692)

kau 09-21-2004 05:35 AM

What is wrong with my PHP?
 
if ($bbuserinfo[usergroupid != 5 OR $bbuserinfo[usergroupid != 6)

This IF statement is not working. What is wrong?

EvilLS1 09-21-2004 06:19 AM

You forgot the last bracket on $bbuserinfo[usergroupid].

Jolten 09-21-2004 06:28 AM

You might also want to encompass each side of the expression in a container.

if (($bbuserinfo[usergroupid] != 5) OR ($bbuserinfo[usergroupid] != 6))

Dean C 09-21-2004 08:03 AM

Moved to the correct forum :)

Xenon 09-21-2004 10:47 AM

also it's easier to use the in_array for such things:

PHP Code:

if (!in_array($bbuserinfo['usergroupid'], array(5,6))) 

btw the statement above is wrong on several places, because it would always be true ;)
i assume you need an and ;)

clamcrusher 09-21-2004 10:25 PM

and also, i beleive you should be using || instead of OR

AND and OR are bitwise operators. If you dont know what those are, you should probably avoid them altogether

use && instead of AND
use || instead of OR

Zachery 09-21-2004 10:53 PM

Quote:

Originally Posted by clamcrusher
and also, i beleive you should be using || instead of OR

AND and OR are bitwise operators. If you dont know what those are, you should probably avoid them altogether

use && instead of AND
use || instead of OR

|| and OR are the same thing.

Somthing about the boolean logic is bad.

Brad 09-22-2004 02:03 AM

Quote:

Originally Posted by clamcrusher
and also, i beleive you should be using || instead of OR

AND and OR are bitwise operators. If you dont know what those are, you should probably avoid them altogether

use && instead of AND
use || instead of OR

http://www.vbulletin.com/docs/html/m...andards_and_or

from: http://www.vbulletin.com/docs/html/codestandards

Tekton 09-22-2004 05:37 AM

Meh, I think I'll continue using && and || ^__^;;

Xenon 09-22-2004 11:22 AM

bit wise operators are & and |
&& and || as well as AND and OR are boolean operators in PHP

using AND/OR in conditions and &/| for bitwise ops makes the code more readable, that's why i defined AND/OR as macros in my C++ as well :)


All times are GMT. The time now is 09:58 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00962 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete