kbsize=size

Discussion in 'PHP' started by Kuna, Aug 26, 2010.

  1. #1
    In file.php I have this
    
    function fsize($file) {
    	$size = filesize($file);
    	$kbsize = $size / 1024;
    	return round($kbsize); 
    }
    
    PHP:
    in other file I have this
    
    $size = fsize($target_path);
    $kbsize = $size;
    
    PHP:
    I know that $size is in bytes, and $kbsize is in kilobytes

    What this means
    $kbsize = $size;
     
    Kuna, Aug 26, 2010 IP
  2. Cyb3rgh0st_

    Cyb3rgh0st_ Greenhorn

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    i dont understand what you are getting at with the
    "$kbsize = $size;"

    whats your prob ?
     
    Cyb3rgh0st_, Aug 26, 2010 IP
  3. Kuna

    Kuna Well-Known Member

    Messages:
    426
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    <? echo .$kbsize. ?> -->it shows size of uploaded file in kilobytes

    does that means that $kbsize is the same as $size or what?
     
    Last edited: Aug 26, 2010
    Kuna, Aug 26, 2010 IP
  4. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #4
    Chances are that the second code looked like the previous code (then later changed). You can do this instead:

    
    $kbsize = fsize($target_path);
    
    PHP:
    since you will not be using the size variable, and yes they are the same (size = kbsize).
     
    ThePHPMaster, Aug 26, 2010 IP
  5. efikra

    efikra Guest

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?
    //$size is fonction
    $kbsize = $size;
    echo"$kbsize; ";
    ?>
     
    efikra, Aug 26, 2010 IP