How to use ternary operator in php?
use ternary operator in php
Hello to all, welcome to therichpost.com. In this post, I will tell you, How to use ternary operator in php?
I have started learning php from four year ago. is the best web language. There are many cms and frameworks in PHP and is the best example. also used in it.
In PHP, there is ternary operator and this is very good operator to use. This is conditional operator.
This is easy way to write if else statement.
Here is an easy example for ternary operator in php:
<?php $text = "test"; echo ($text == "test" ? "yes" : "worng") ; //This will print echo becuase condition is true ?>
There are so many code in PHP and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com
You Might Also Like
Hello to all, welcome to therichpost.com. First of all, I just want to wish you all very Happy Diwali.In this...
Hello to all, welcome to therichpost.com. In this post, I will do, Database Seeding in Laravel 5.7 With Faker Package.In this...