I have the following code

<a href="<'. Url::to(['site/campaign']) .'" class="pull-right text-green"> '. HtmlPurifier::process($camp['CampaignStatus'] < 1 ? 'Intiated' : (($camp['CampaignStatus'] < 2 ? 'Drafted' )))  . '</a> 

but it's giving me the following error:

ParseError syntax error, unexpected ')'

Can anyone see what's going wrong here or how to fix it?

You're missing your second option in the second ternary operator:

($camp['CampaignStatus'] < 2 ? 'Drafted' : <SHOULD BE SOMETHING HERE> )

Thanks for your help hericle . I just a newbie into programming world. It would really helpful if you can give me an example what you mean by <SHOULD BE SOMETHING HERE>

Solved it.

Good to hear.
For clarification for any others that find this, the initial code was an if statement without an elseif.
$camp['CampaignStatus'] < 2 ? 'Drafted'

It was incomplete as it asked

if ($camp['CampaignStatus']  < 2 ) {
        return 'Drafted';
} else if() {

}

which won't compile in any language.

commented: Always good to see an explanation for the benefit of others. +1 +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.