Categories

Thursday, March 28, 2024
#919814419350 therichposts@gmail.com
Php

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. PHP is the best web language. There are many cms and frameworks in PHP and WordPress is the best example. facebook also used PHPin 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

 

 

 

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.