mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-07 14:36:29 +02:00
Update The-Basics.md
Updated to conform to rest of document and I believe that I have utilized the correct syntax for then highlighters.
This commit is contained in:
@@ -305,15 +305,21 @@ vs.
|
||||
$a = 5;
|
||||
return ($a == 5) ? 'yay' : 'nope'; // this example will return 'yay'
|
||||
|
||||
It should be noted to save confusion that you do not need to use a ternary operator for returning a boolean value. An example of this would be.
|
||||
{% endhighlight %}
|
||||
|
||||
It should be noted that you do not need to use a ternary operator for returning a boolean value. An example of this would be.
|
||||
|
||||
{% highlight php %}
|
||||
<?php
|
||||
$a = 3;
|
||||
return ($a == 3) ? true : false; // Will return true or false if $a == 3
|
||||
|
||||
vs
|
||||
|
||||
$a = 3;
|
||||
return ($a == 3); // Will return true or false if $a == 3
|
||||
return $a == 3; // Will return true or false if $a == 3
|
||||
|
||||
{% endhighlight php %}
|
||||
|
||||
This can also be said for all operations(===, !==, !=, == etc).
|
||||
|
||||
|
Reference in New Issue
Block a user