Example for Conditional Operator in php

16-04-2017 php Conditional Operator example

Try following example to understand the conditional operator.

$a = 10;
$b = 20;

 /* If condition is true then assign a to result otheriwse b */
$result = ($a > $b ) ? $a :$b;
echo $result;

Here $a is if condition and $b is in else condition.

 

 

You might also like:

How to insert bulk information into database in single query execution
18-03-2017 insert sql bulk database
Sanitization in java sript
14-03-2017 sanitization java script
Get previous date from given date in javascript
06-03-2017 date javascript previous date
How to find Angular Errors
06-03-2017 errors angularjs exceptionHandler
How to change background color and color to the text using javascript
27-02-2017 css javascript colors