I want to convert the following statement if else conditionto nested ternary.
if ($projectURL) {
echo $projectURL;
} elseif ($project['project_url']) {
echo $project['project_url'];
} else {
echo $project['project_id'];
}
I wrote the following:
echo ($projectURL)?$projectURL:($project['project_url'])?$project['project_url']: $project['project_id'];
But it is found as not working properly. Is this not the right way?
source
share