Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il

Hostgator - Save 50% Off Your New Optimized WordPress Hosting With Coupon: WDA50

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Dedicated Hosting Superb Internet

simplilearn big data and analytics

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Buy Cool Shirts

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,300 questions

8,938 answers

573 users

How to output large numbers in PHP

Directory of Wholesale Companies and Dropship Suppliers | SaleHoo

11 views
asked Jul 26 by avibootz

1 Answer

0 votes
$numbers = [1, 2, 3, 4, 5, 6, 7, 13];

foreach ($numbers as $n) {
    $rv = pow(1024, $n);
    printf("pow(1024, %d) > (%8s) %21s %40.0F\n<br />", $n, gettype($rv), $rv, $rv);
}


/*
run: 
 
pow(1024, 1) > ( integer) 1024 1024 
pow(1024, 2) > ( integer) 1048576 1048576 
pow(1024, 3) > ( integer) 1073741824 1073741824 
pow(1024, 4) > ( double) 1099511627776 1099511627776 
pow(1024, 5) > ( double) 1.1258999068426E+15 1125899906842624 
pow(1024, 6) > ( double) 1.1529215046068E+18 1152921504606846976 
pow(1024, 7) > ( double) 1.1805916207174E+21 1180591620717411303424 
pow(1024, 13) > ( double) 1.3611294676838E+39 1361129467683753853853498429727072845824 
 
*/

 




answered Jul 26 by avibootz
...