Jump to content

Ternary Operator In Mamp


Recommended Posts

so im using MAMP, and i am trying to get this ternary operator to work. when i use a regular if statement, my variable gets set, but if i use the ternary operator, it doesnt. I have no clue what im doing wrong. Ive looked at several tutorials and i thought i was doing this right.if statement

if($type == 'ad_campaigns') { $table = 'ad_campaigns';}

ternary operator version

$table = ($type == 'ad_campaigns') ? 'ad_campaigns' : '';

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...