Example for Conditional Operator in php

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:

Check null values in JavaScript?

04-02-2019 JavaScript null check null value

How to insert bulk information into database in single query execution

18-03-2017 insert sql bulk database

How to use request module in node js

16-03-2017 request module node js

Sanitization in java sript

14-03-2017 sanitization java script

How to remove last / value from url in javascript

27-02-2017 array javascript last value