~n[EO]n~ Posted November 15, 2007 Share Posted November 15, 2007 Hi, can someone tell me what this code is trying to do, please <?php $cat_type=$Admin_type=="Products"?1:2; // that 1:2 in the end ?> Thanks Link to comment https://forums.phpfreaks.com/topic/77420-solved-a-simple-question-i-think/ Share on other sites More sharing options...
teng84 Posted November 15, 2007 Share Posted November 15, 2007 that is ternary operator same as if else if ($var =='cool') $teng =1; else $teng =2; ternary $teng =($var=='cool')?1:2; ? is the value if true : value if false Link to comment https://forums.phpfreaks.com/topic/77420-solved-a-simple-question-i-think/#findComment-391936 Share on other sites More sharing options...
~n[EO]n~ Posted November 15, 2007 Author Share Posted November 15, 2007 Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/77420-solved-a-simple-question-i-think/#findComment-391940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.