Reputation: 844
i have this:
<?php
$values = $cfs->get('promoter');
if (!empty($values)) {
echo $cfs->get_labels('promoter');
echo implode(', ', array_keys($values));
}
?>
<br />
which prints something like this:
PromoterPromoter1, Promoter2
when i'd like something like this:
Promoter: Promoter1, Promoter2
also, how could i include the <br />
within the php, so if the field is blank, the line break is also excluded?
thanks.
Upvotes: 0
Views: 118
Reputation: 123
<?php
$values = $cfs->get('promoter');
if (!empty($values)) {
$word = "";
$word .= $cfs->get_labels('promoter');
$word .= ": ";
$word .= implode(', ', array_keys($values));
$word .= "<br />";
echo $word;
}
?>
Upvotes: 0
Reputation: 10995
<?php
$values = $cfs->get('promoter');
if (!empty($values)) {
echo $cfs->get_labels('promoter').": ";
echo implode(', ', array_keys($values))."<br />";
}
?>
Use PHP's concatenation operator - i.e. a period.
Upvotes: 2
Reputation: 43810
You can simply append a string ": "
to the end
echo $cfs->get_labels('promoter').": ";
Upvotes: 1