IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesC++Statements  Print This     

Cross Ref > Statements

By Mike Prestwood

C++ versus PHP: A side by side comparison between C++ and PHP.

 
Statements
 

Common statements such as if statements, loops, etc.

Exception Trapping

[Other Languages] 

Languages Focus

A common usage of exception handling is to obtain and use resources in a "try-it" block, deal with any exceptions in an "exceptions" block, and release the resources in some kind of "final" block which executes whether or not any exceptions are trapped.

C++:   try/catch
Syntax Example:
try {
  //Some code.
}
catch(AnError) {
  //Error code here.
}
[Not specified yet. Coming...]




If Statement

[Other Languages] 
C++:   if..else if..else

Same as standard C.

Syntax Example:
//C++Builder example using the VCL ShowMessage.
int x;
  
x = 8;
  
if (x == 10) {
ShowMessage("x is 10.");
} else if (x < 10) {
ShowMessage("x is less than 10.");
} else {
ShowMessage("x must be greater than 10.");
}
PHP:   if..elseif..else

The PHP if statement consists of using if, elseif, and else.

Syntax Example:
$x = 8;
  
if ($x == 10) {
 echo "x is 10."; 
} elseif ($x < 10) {
 echo "x is less than 10.";
} else {
 echo "x must be greater than 10."; 
};




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]