Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. <?php
  2. // http://shuchkin.livejournal.com
  3. function format_size($size) {
  4.       $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
  5.       if ($size ==  0) { return('n/a'); } else {
  6.       return (round($size/pow(1024, ($i = floor(log($size, 1024)))), $i > 1 ? 2 :  0) . $sizes[$i]); }
  7. }
  8. ob_implicit_flush();
  9. ?>
  10. <table cellpadding="3" border="1" style="border-collapse:collapse">
  11. <tr><td>name</td><td>date</td><td>size</td></tr>
  12. <?php foreach( glob('dir/*.*') as $f ): ?>
  13. <tr><td><?= basename( $f ); ?></td><td><?= format_size( filesize( $f ) ); ?></td><td><?= date('Y-m-d H:i',filemtime( $f )); ?></td></tr>
  14. <?php endforeach; ?>
  15. </table>




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2012