Reputation: 3
What does the following bit of code mean in "English"?
Just started learning PHP & Codeigniter and cant seem to make sense of it.
<meta name="description" content="<?if (isset($contentdata) && isset($contentdata->description)):?><?=$data->description?><?=$contentdata->description?><?endif;?>" />
As far as i understand, it gets info from the database, but i'm not too sure how, or why the two conditions must be true (&&).
Upvotes: 0
Views: 69
Reputation: 14983
//if there's a variable $contentdata AND it has a property ->description
<?if (isset($contentdata) && isset($contentdata->description)):?>
//shorthand syntax for <?php echo $data->description ?>
<?=$data->description?>
//shorthand syntax for <?php echo $contentdata->description ?>
<?=$contentdata->description?>
Upvotes: 1