Welcome Guest, Not a member yet? Register   Sign In
[Thanks All For Advice] Checking if isset is correct?
#5

The Ternary is great for deciding on which of two possible values to return.
But in this case you are deciding whether or not to take one possible action.

Code:
<?php
if(isset($view['navbar']){
   $this->load->view($view['navbar']);
}

In this particular case the ternary is not needed and a simple if statement is cleaner.
Reply


Messages In This Thread
RE: Checking if isset is correct? - by JayAdra - 09-09-2016, 04:39 AM
RE: Checking if isset is correct? - by InsiteFX - 09-09-2016, 04:55 AM
RE: Checking if isset is correct? - by dave friend - 09-09-2016, 02:35 PM
RE: Checking if isset is correct? - by PaulD - 09-10-2016, 11:50 AM
RE: Checking if isset is correct? - by Wouter60 - 09-11-2016, 10:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB