echo '<div class="currency"><ul>';
for ($i=0; $i < $count_obj ; $i++) {
if($obj[$i]['percent_change_24h'] > 0) {
$color_change = '#4ac06a';
$plus = '+';
} else {
$color_change = '#ff8d8d';
$plus = '';
}
echo '<li>';
echo '<i class="cc '.$obj[$i]["symbol"].' iconsi" title="'.$obj[$i]["name"].'"></i>';
echo '<div class="block_coin">';
echo '<span class="coin_name">'.$obj[$i]["name"].'</span><span style="color:'.$color_change.';" class="coin_price">'.$obj[$i]["price_usd"].'$</span>';
echo '<span style="color:'.$color_change.';" class="coin_change">(';
echo $plus.$obj[$i]["percent_change_24h"];
echo '%)</span></div></li>';
}
echo '</ul></div>';
<div class="currency">
<ul>
<? foreach ($obj as $element):?>
<? $color = ($element['percent_change_24h'] > 0) '#4ac06a' : '#ff8d8d'; ?>
<? $plus = ($element['percent_change_24h'] > 0) '+' : ''; ?>
<li>
<i class="cc <?=$element["symbol"];?> iconsi" title="<?=$element["name"];?>"></i>
<div class="block_coin">
<span class="coin_name"><?=$element["name"];?></span>
<span style="color: '<?=$color;?>';" class="coin_price"><?=$element['price_usd'];?></span>
<span style="color: '<?=$color;?>';" class="coin_change">(<?=$plus;?><?=$element["percent_change_24h"];?>%)</span>
</div>
</li>
<? endforeach; ?>
</ul>
</div>
<div class="currency">
<ul>
<?php
for ( $i = 0; $i < $count_obj; $i++ ) {
if ( $obj[ $i ][ 'percent_change_24h' ] > 0 ) {
$color_change = '#4ac06a';
$plus = '+';
} else {
$color_change = '#ff8d8d';
$plus = '';
}
?>
<li><i class="cc <?=$obj[$i][" symbol "]?> iconsi" title="<?=$obj[$i][" name "]?>"></i>
<div class="block_coin">
<span class="coin_name">
<?=$obj[$i]["name"]?>
</span>
<span style="color:<?=$color_change?>;" class="coin_price">
<?=$obj[$i]["price_usd"]?>$</span>
<span style="color:<?=$color_change?>;" class="coin_change">(<?=$plus.$obj[$i]["percent_change_24h"]?>%)</span>
</div>
</li>
<?php
}
?>
</ul>
</div>