php convert numbers to text in for loop after one billion

Viewed 18

I have this code:

for ($x = 0; $x <= 60; $x++) {
  $t = 2**$x; 
  echo "<br> $x - $t ";
} 

How can I make that after the numbers hit 1 billion, it will convert to text format?

Example:

29 - 536870912 
30 - 1 billion, 73 million, 7 hundred thousand etc. (1073741824)
0 Answers
Related