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 upload file by using request module
18-03-2017 request module node js
How to make an http request in node js
14-03-2017 http module node js
How to get current date and time (yyyy-mm-dd H:i:s) using javascript
09-03-2017 javascript date time
How to remove last / value from url in javascript
27-02-2017 array javascript last value
Send Mail in Node Js
21-02-2017 node js mail npm module