View Full Version : Resolved hide a value

01-24-2010, 08:18 PM
Hi im using this code to automatically convert KB into MB

$size = $data['size'];
$size = preg_replace("#[a-z]#i", '', $size);
$size = round($size/1024);
echo $size.'MB';

I want to make it so when no KB is available for it to be blank. right now when no KB is available it prints 0MB and i want that hidden. can someone help me? Thanks.

01-24-2010, 08:30 PM
echo (($size > 0) ? $size.'MB' : '');

01-24-2010, 08:37 PM
echo (($size > 0) ? $size.'MB' : '');

that works great. Thanks again!:thumbsup: I was going at it with the wrong approach.