vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   using iif statements (https://vborg.vbsupport.ru/showthread.php?t=61841)

AN-net 02-23-2004 11:48 PM

using iif statements
 
can someone explain to me how to use these? can they used to check if a value is false or true and if true display something?

Velocd 02-24-2004 12:01 AM

Syntax:

PHP Code:

if (condition is met)
{
do 
this
}
// Below is optional.
else if(another condition is met)
{
do 
this
}
else
{
do 
this


Conditions are boolean expressions, evaluated under true or false.

For example:

Code:

if ($bbuserinfo['username'] == 'some_dude')
{
echo "Hey some_dude!";
}

Check out www.php.net for more information.

AN-net 02-24-2004 12:09 AM

no, i mean iif statements that vb uses in vb3 coding but thanks for the help

filburt1 02-24-2004 12:25 AM

Quote:

Originally Posted by AN-net
no, i mean iif statements that vb uses in vb3 coding but thanks for the help

PHP Code:

$variable iif($expression$truevalue$falsevalue); 

so
PHP Code:

$i 1;
echo 
iif($i == 1"i is one""i is not one"); 

It is exactly the same as the built-in PHP ternary operator, and exactly the same in C, C++, and Java:
PHP Code:

$i 1;
echo (
$i == "i is one" "i is not one"); 


AN-net 02-24-2004 12:29 AM

so you have a true and false value after $blah==whatever?

Natch 02-24-2004 01:10 AM

Quote:

Originally Posted by AN-net
so you have a true and false value after $blah==whatever?

The format of this phrase
PHP Code:

if ($this == "1") {
$do $this;
}
else 
{
$do $that;


is functionally identical to the following in regular PHP
PHP Code:

$do = ($this == "1") ? $this $that 

PHP Code:

$do iif($this == "1",$this,$that); 


AN-net 02-24-2004 03:31 AM

thanks guys


All times are GMT. The time now is 02:43 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.01088 seconds
  • Memory Usage 1,733KB
  • 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_code_printable
  • (7)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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