it can be even easier make an array
<?php
$online_imgs = array('online0.jpg','online1.jpg','online2.jpg',....);
//the 10 can be changed to whatever you want
$image_index = round($total_online / 10);
$online_img_src = (isset($online_imgs[$image_index])) $online_imgs[$image_index] ? ...