co.ador Posted May 20, 2009 Share Posted May 20, 2009 Can you guys explain me what does this mean? $cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null; $prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null; $menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null And how can I use this values, give me as much opinios as you can. I want to know how can I use a value when is isset($_GET, is_numeric($_GET, $_GET and null. one example would be $class = !is_null($cat) && $cat==$row['id']?' class="selected"':'' Thank you.. Quote Link to comment https://forums.phpfreaks.com/topic/158836-how-can-i-use-isset-values/ Share on other sites More sharing options...
Maq Posted May 20, 2009 Share Posted May 20, 2009 Please refer to the manual for what each of these functions do. The code there is equivalent to this: if(isset($_GET['subject'] && is_numeric($_GET['subject'])) { $cat = $_GET['subject']; } else { $cat = null; } if(isset($_GET['menu']) && is_numeric($_GET['menu'])) { $prod = $_GET['menu']; } else { $prod = null; } if(isset($_GET['menu_type']) && is_string($_GET['menu_type'])) { $menu_type= $_GET['menu_type']; } else { $menu_type = null; } ?> The only difference is that it's using ternary operators. Quote Link to comment https://forums.phpfreaks.com/topic/158836-how-can-i-use-isset-values/#findComment-837772 Share on other sites More sharing options...
co.ador Posted May 20, 2009 Author Share Posted May 20, 2009 From what I read isset can have a value of false or true right? Quote Link to comment https://forums.phpfreaks.com/topic/158836-how-can-i-use-isset-values/#findComment-837782 Share on other sites More sharing options...
Maq Posted May 20, 2009 Share Posted May 20, 2009 From what I read isset can have a value of false or true right? isset Like I mentioned before, you can find all the function details in the manual. But yes, it returns a boolean. Quote Link to comment https://forums.phpfreaks.com/topic/158836-how-can-i-use-isset-values/#findComment-838078 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.