Skip to main content
changed to non-shorthand PHP tag
Source Link
Rarst
  • 99.9k
  • 10
  • 160
  • 298

Here is a bad way that works.

<h2 class="single_category"><?
if ($cat[0]->name != "Front_Page") {
    echo $cat[0]->name;
} else {
echo $cat[1]->name;
}
?></h2>

Here is a bad way that works and takes up less space.

<?php echo ($cat[0]->name != "Front_Page") ? $cat[0]->name : $cat[1]->name; ?>

Here is a bad way that works.

<h2 class="single_category"><?
if ($cat[0]->name != "Front_Page") {
    echo $cat[0]->name;
} else {
echo $cat[1]->name;
}
?></h2>

Here is a bad way that works and takes up less space.

<? echo ($cat[0]->name != "Front_Page") ? $cat[0]->name : $cat[1]->name; ?>

Here is a bad way that works.

<h2 class="single_category"><?
if ($cat[0]->name != "Front_Page") {
    echo $cat[0]->name;
} else {
echo $cat[1]->name;
}
?></h2>

Here is a bad way that works and takes up less space.

<?php echo ($cat[0]->name != "Front_Page") ? $cat[0]->name : $cat[1]->name; ?>
Source Link

Here is a bad way that works.

<h2 class="single_category"><?
if ($cat[0]->name != "Front_Page") {
    echo $cat[0]->name;
} else {
echo $cat[1]->name;
}
?></h2>

Here is a bad way that works and takes up less space.

<? echo ($cat[0]->name != "Front_Page") ? $cat[0]->name : $cat[1]->name; ?>