I have locally two images: /images/green_arrow_up.png /images/red_arrow_down.png. In my database I have a record and I fetch a number in this case.
["data"]=>
array(2) {
[0]=>
array(2) {
[0]=>
array(15) {
[14]=>
string(8) "+1.22%"
}
}
}
I fetch the data like this
<div class="stats-item"><?php echo number_format((float)@$data->data[0][0][14], 2, '.', ''); ?>% </div>
Depending on the array from which i fetch the data the result can be +1.22% or -1.22% for example. I want if the result is positive (1.22%) to display the green_arrow_up before the number. And if the result is negative (-1.22%) I want to display the red_arrow_down.