Comments on: Three Tips for Writing Airtight PHP Conditions https://wpshout.com/three-tips-for-writing-airtight-php-conditions/ A hub for advanced WordPress users, developers & savvy business owners. Thu, 23 Apr 2020 03:07:23 +0000 hourly 1 https://wordpress.org/?v=6.4.3 By: Thyme https://wpshout.com/three-tips-for-writing-airtight-php-conditions/#comment-21540 Sun, 21 Jul 2019 11:46:05 +0000 https://wpshout.com/?p=19236#comment-21540 Great article! I personally found it very helpful. Thanks!

]]>
By: WPSelected https://wpshout.com/three-tips-for-writing-airtight-php-conditions/#comment-21539 Mon, 15 Jul 2019 09:25:52 +0000 https://wpshout.com/?p=19236#comment-21539 It’s enlightening for the ones who wonder about this topic. Congrats!

]]>
By: Fred Meyer https://wpshout.com/three-tips-for-writing-airtight-php-conditions/#comment-21538 Fri, 12 Jul 2019 20:29:08 +0000 https://wpshout.com/?p=19236#comment-21538 In reply to WPezDeveloper.

Thanks! I like that change.

]]>
By: WPezDeveloper https://wpshout.com/three-tips-for-writing-airtight-php-conditions/#comment-21537 Fri, 12 Jul 2019 11:47:28 +0000 https://wpshout.com/?p=19236#comment-21537 Good stuff. One thought to add. From what I understand if () {} else {} is slightly slower than a plain if. Maybe this has change in PHP 7.*+?

In any case, in the name of brevity and simplicity.

$echo_this = 'Wait what';
if ( $integer !== $string ){
	$echo_this = 'Okay, good';
}
echo $echo_this;

That is, set the default value and use a conditional to change it, only if the conditional is met.

]]>
By: Joshua Otwell https://wpshout.com/three-tips-for-writing-airtight-php-conditions/#comment-21536 Fri, 12 Jul 2019 01:49:35 +0000 https://wpshout.com/?p=19236#comment-21536 This post is so fantastically written and very informative. There is much to learn here for good practices no matter what language you use. Excellent ????

]]>