StyleGame

Doriți să reacționați la acest mesaj? Creați un cont în câteva clickuri sau conectați-vă pentru a continua.
StyleGame

Online Tutorials

Va rog sa faceti cunoscut forumu. Cum puteti ajuta? De preferat la status pe yahoo messenger massuri etc. Va urez bafta in a ne ajuta cu respect echipa stylegame

    [PHP] A easy way to check the file size

    CYobY
    CYobY
    Administrator
    Administrator


    Mesaje : 197
    Data de inscriere : 04/10/2009
    Varsta : 30
    Localizare : VASLUI

    [PHP] A easy way to check the file size Empty [PHP] A easy way to check the file size

    Mesaj Scris de CYobY Sam Oct 24, 2009 6:28 pm

    Cod:
        function StringSizeToBytes($Size){

            $Unit = strtolower($Size);
            $Unit = preg_replace('/[^a-z]/', '', $Unit);

            $Value = intval(preg_replace('/[^0-9]/', '', $Size));

            $Units = array('b'=>0, 'kb'=>1, 'mb'=>2, 'gb'=>3, 'tb'=>4);
            $Exponent = isset($Units[$Unit]) ? $Units[$Unit] : 0;

            return ($Value * pow(1024, $Exponent));         
        }

      Data/ora curentă este: Dum Mai 19, 2024 1:52 pm