Converting a date format, simply and quickly.
This function is used on my own site : http://www.maggsweb.co.uk
Converting a date format, simply and quickly.
This function is used on my own site : http://www.maggsweb.co.uk
Nicely displaying the filesize, using bytes, megabytes, etc..
= 1024) {
$size /= 1024;
$pos++;
}
return round($size,1)." ".$type[$pos];
}
?>
How to resubmit generated sitemaps automatically (using cron) or on an event (like re-generation of the sitemap).
And the function goodiness….
Easy way of switching between mysql and “normal” dates (english, not american)…
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;
}
?>
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.
Remove all non alpha-numeric characters from a string.
Function to create TinyURL’s on-the-fly
http://tinyurl.com/
I hate compressing CSS files as they become totally unreadable for editing. I end up keeping 2 versions, compressed and uncompressed, etc.. But how about compressing all your CSS files into one file, ‘on-the-fly’. Now that has solved the problem.
Just a little script I wrote to work out the date of the first day of the week.
Continue reading