PHP Ternary Operator vs if else Statement Explained

preview_player
Показать описание
In this video I show you how to code with the PHP Ternary Operator and also compare it to the typical if else statement.

Get the Code for this video:

The PHP Ternary Operator is another way to handle your decision making or conditional statements in PHP and you will find that it is a more compact way to get the same results vs the more verbose if else statement.

Checkout this video about Full Stack Web Development:

I show you how to create a basic ternary operator and then I show you how you can inline your ternary operator in a string which can be useful if you want to output the results of the ternary operator along with a string.

See What's on my Desk:

This can also be useful when you want to do a quick conditional check for a CSS class value to apply to an html tag.

There are a lot of uses for the ternary operator and hopefully this video will shed some light on how to use it and how it compares to the if else we often use in our PHP conditional code.

Support the channel by using some of my services, offerings and affiliate links below.
By using the links below, I do make some additional revenue which helps to support my efforts of teaching you how to code.

Domain Name & Hosting

Music from Epidemic

TubeBuddy Affiliate Link

My Patreon Page

Learn WordPress Theme Development

By using the links above, I might make a few dollars which helps me to dedicate time creating content. I appreciate your support.

Find me on Instagram:

Find me on Twitter:

Find me on Facebook:

#php
Рекомендации по теме
Комментарии
Автор

@PixemWeb You're a star!
keep up the good work! ;)

maxf
Автор

I too enjoyed your tutorials and found them educational. Will you be doing any more beginner videos on php?

robertjohnson
Автор

thank you! and your website is really helpful!

rendezvousss