zoobzen Posted September 16, 2010 Share Posted September 16, 2010 I need some help understanding the below syntax (the ? and the colon are throwing me) isset($_POST['cardType']) ? $_POST['cardType'] : ''; Thanks for any help on this .. Frank Quote Link to comment https://forums.phpfreaks.com/topic/213618-need-help-understanding-symbols/ Share on other sites More sharing options...
mikosiko Posted September 17, 2010 Share Posted September 17, 2010 is called a ternary operator basically is the reduced version of a if... else construction http://php.net/manual/en/language.operators.comparison.php Quote Link to comment https://forums.phpfreaks.com/topic/213618-need-help-understanding-symbols/#findComment-1111891 Share on other sites More sharing options...
chintansshah Posted September 17, 2010 Share Posted September 17, 2010 it's ternary operator which take place of if else statement. // in ternary operatorisset($_POST['cardType']) ? $_POST['cardType'] : '';// in if..elseif(isset($_POST['cardType'])){$cardType = $_POST['cardType'];}else{$cardType = '';} I hope you cleared. Quote Link to comment https://forums.phpfreaks.com/topic/213618-need-help-understanding-symbols/#findComment-1111976 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.