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:

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

Detect AdBlock with JavaScript in my browser

30-07-2017 AdBlock javascript detect

How to make an http request in node js

14-03-2017 http module node js

Remove last two characters from given string

06-03-2017 substring javascript remove

Send Mail in Node Js

21-02-2017 node js mail npm module