To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Tools > Dreamweaver

Dreamweaver In need of help with Dreamweaver?

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-30-2002, 09:20 PM   #1
rbeemsterboer
Junior Member
 
Join Date: Aug 2002
Location: Amsterdam, Netherlands
Posts: 8
Dreamweaver MX uses ? and : to do what !?

Hi,

I'm tryed using Dreamweaver MX, but can anyone explain what does ? and : mean as a function, Because do not understand it :-)

$colname_Organisation = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['OrgId'] : addslashes($HTTP_GET_VARS['OrgId']);

Best Regards,
RIck Beemsterboer
Netherlands
rbeemsterboer is offline   Reply With Quote
Old 12-30-2002, 10:08 PM   #2
128kb.com
Senior Member
 
Join Date: Dec 2002
Location: Boston Baby!
Posts: 138
The ?: is the ternary operator for doing an if/else as an expression. For instance... an if/else block can't be used on the right side of an asignment operator or inside an expression.
PHP Code:
$(is_array($var)) ? print  "true\n" : print "false\n";
is analogus to:
PHP Code:
if (is_array($var))
    print  
"true\n";
else
    print
"false\n";
so you can say
PHP Code:
$somevar = $(is_array($var)) ? true : false;
You can get really tricky with this inside complex expressions.
http://www.php.net/manual/en/languag...comparison.php
__________________
jhannus@128kb.com

Last edited by 128kb.com; 12-30-2002 at 10:11 PM.
128kb.com is offline   Reply With Quote
Old 01-30-2003, 11:14 AM   #3
sanu
Member
 
Join Date: Jan 2003
Posts: 64
couldn't get u

couldn't get what actually ternary operater do and where is it suitable to use could you please explain it more
__________________
cheers
sanu is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 05:41 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.