I have a table of data im importing, the contents of a particular row looks like this...
500, 1000, 2000, 4000, 5000, 8000, 10000, 12000, UNLIMITED
Each number represents Megabytes where as 8000 is 8000mb or 8gb I need a function which will knock off the last 3 zero's of the number if it is greater than 999 then add "GB" to the end of the number if not over 999 add "MB" to the end of the original number. so i end up with for each cell e.g. 500MB or 8GB - also I need the function to just echo "unlimited" in lower case if the case is "UNLIMITED" this would have been easy last year but im really rusty with my PHP at the minute and need a refresher course. Can you help me?
heres the code I have already wrote it doesn't work though...
function gigaplex($data) {
if ($data = 300) {
echo "300MB";
} elseif ($data = 500) {
echo "500MB";
} elseif ($data = 1000) {
echo "1GB";
} elseif ($data = 2000) {
echo "2GB";
} elseif ($data = 3000) {
echo "3GB";
} elseif ($data = 4000) {
echo "4GB";
} elseif ($data = 5000) {
echo "5GB";
} elseif ($data = 8000) {
echo "8GB";
} elseif ($data = 10000) {
echo "10GB";
} elseif ($data = 12000) {
echo "12GB";
} else {
echo "unlimited";
}
}