PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// Function to convert number to scientific notation and return as formatted string.
// Yes, I realize I could do the same with sprintf()
function toSci($n) {
$power = 0;
while ($n >= 10) {
$n /= 10;
$power++;
}
return ($power) ? $n.'e+'.$power : $n;
}
Lol, i'm getting a message that the division operator in this section of code is unsupported, WTF!?!
I was neglecting the fact that I was trying to make the assignment using the list function. Because my toSci function wasn't returning an array like list() expected I got the error. Anyway, problem solved, thanks for showing interest.