Tag Archives: function

Show Bytes

Haven’t actually used this one, but it does work…

 1099511627776,  // pow( 1024, 4)
		'GB' => 1073741824,     // pow( 1024, 3)
		'MB' => 1048576,        // pow( 1024, 2)
		'kB' => 1024,           // pow( 1024, 1)
		'B ' => 1,              // pow( 1024, 0)
	);

	foreach ( $quant as $unit => $mag )
		if ( doubleval($bytes) >= $mag )
			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;

	return false;
}
?>

Dump variables

This is my extension of an existing function, adatped for my requirements.

";
    $output .= "";
    $output .= "";
    $output .= "" . $VARIABLE_NAME . "";
    $output .= "";
    $output .= "";
    if (is_array($data)){
        foreach ($data as $key => $value) {
            //$value = dumpr($key, $value);
            $output .= "";
            $output .= "$key";
            $output .= "$value";
            $output .= "";
        }
    } else {
        $output .= "";
        $output .= "$data";
        $output .= "";
    }
    $output .= "";
    $output .= "";
    return $output;
}
?>

Use like this:
echo dumpr(‘NAME’,$var);
echo dumpr(‘SESSION’,$_SESSION);
etc..

Displays a nicely formatted table, with values of a string / array / object clearly displayed.