Learn PHP Ternary Operator, Using Ternary Operator with PHP, Ternary Operator Explained in PHP Code

In this PHP programming lesson we take a look at Learn PHP Ternary Operator, Using Ternary Operator with PHP, Ternary Operator Explained in PHP Code. If you are new to programming I suggest you watch this course from the beginning to get the most out of it. In the past lessons, we have been going over the PHP programming language. We have been building up our syntax and most recently we have been learning about booleans and comparison operators. We have learned of if statements, and if-elseif statements. The ternary operator in PHP is very similar to if-elseif statements except it is cleaner to read and more concise. The ternary operator is a short-hand syntax for our PHP code that allows us to conditionally return a value depending on whether the value evaluates to true or false. Learning to use the ternary operator will help you write cleaner shorter code that makes sense. Learning how the ternary operator works will help you in the future when you are looking to create an if-elseif statement that you need to return a specific value. Make sure to practice using the ternary operator in PHP until it makes sense and is embedded into your programming mind. Thanks for watching Learn PHP Ternary Operator, Using Ternary Operator with PHP, Ternary Operator Explained in PHP Code.