Example for Conditional Operator in php

Conditional Operator

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:

Convert and download html to pdf without saving file

28-10-2018 node js convert html to pdf pdf download pdf without saving

Detect AdBlock with JavaScript in my browser

30-07-2017 AdBlock javascript detect

Sanitization in java sript

14-03-2017 sanitization java script

How to convert html to pdf in Node js

12-03-2017 pdf convert html node js

Get random strings from given string In javascript

21-02-2017 javascript random string