BigToach.com

PHP Snippets

gmail_size

Information

(PHP Version >= 3)
Functions used in this snippet: time, substr, microtime, sizeof.

Description

int gmail_size( void )

Shows the current size that Google offers for its Gmail storage.

Note: It will only work until August 2008, assuming that Google continues to up its storage by 100 megs each month.

Snippet

<?php
function gmail_size(){
    
$sizes = array(    array(11202012000002350),
            array(
11228796000002450),
            array(
11255580000002550),
            array(
11281500000002650),
            array(
11308320000002750),
            array(
11334240000002850),                array(11361024000002950),
            array(
11387808000003050),
            array(
11412000000003150),                array(11438784000003250),
            array(
11464668000003350),
            array(
11491452000003450),                array(11517372000003550),
            array(
11544156000003650),
            array(
11570940000003750),                array(11596860000003850),
            array(
11623680000003950),
            array(
11649600000004050),                array(11676384000004150),
            array(
11703168000004250),
            array(
11727360000004350),                array(11754144000004450),
            array(
11780028000004550),
            array(
11806812000004650),                array(11832732000004750),
            array(
11859516000004850),
            array(
11886300000004950),                array(11912220000005050),
            array(
11939040000005150),
            array(
11964960000005250),                array(11991744000005350),
            array(
12018528000005450),
            array(
12043584000005550),                array(12070368000005650),
            array(
12096252000005750),
            array(
12123036000005850),                array(12148956000005950),
            array(
12175740000006050),
            array(
12202524000006150));
    
$now time() . substr(microtime(), 23);
    for(
$i=0$i<sizeof($sizes); $i++){
        if(
$now $sizes[$i][0]){
            break;
        }
    }
    if(
$i == 0){
        
$ret $sizes[0][1];
    }elseif(
$i == sizeof($sizes)){
        
$ret $sizes[$i 1][1];
    }else{
        
$ts $sizes[$i 1][0];
        
$bs $sizes[$i 1][1];
        
$ret = (($now $ts) / ($sizes[$i][0] - $ts) * ($sizes[$i][1] - $bs)) + $bs;
    }
    return 
$ret;
}
?>

Example

gmail_size Can be used in the following way:

<?php
echo gmail_size(); // returns 2479.784683

// it will be different every time you see it

?>

Added on Aug 10th at 8 am by Scott - 0 Comments


0 Responses to gmail_size

Name:

Site or Mail:

Comment:

To try to reduce the ammount of spam, please enter the word GOOSE in the following form

Security Code: