Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $changes = array( );
- $touched = array( );
- $files = array( '1.txt', '2.txt', '3.txt' );
- $totalchanged = 0;
- $totaltouched = 0;
- $author = '';
- foreach( $files as $file )
- {
- $c = file( $file );
- foreach( $c as $o )
- {
- $o = trim( $o );
- if( $o == '' ) { }
- elseif( strpos( $o, "\t" ) === false )
- {
- $author = $o;
- if( $author == 'Fenix1053' )
- $author = 'Fenix';
- elseif( $author == 'CCarlon' )
- $author = 'CC';
- if( !isset( $changes[ $author ] ) )
- $changes[ $author ] = 0;
- if( !isset( $touched[ $author ] ) )
- $touched[ $author ] = 0;
- }
- else
- {
- $x = explode( "\t", $o );
- if( $x[0] != '-' )
- {
- $changes[ $author ] += $x[0] + $x[1];
- $totalchanged += $x[0] + $x[1];
- }
- else
- {
- $touched[ $author ] ++;
- $totaltouched++;
- }
- }
- }
- }
- arsort( $changes );
- foreach( $changes as $author => $changed )
- {
- echo $author . ': ' . $changed . ' (' . round( $changed / $totalchanged * 100, 2 ) . '%) lines, ' . $touched[ $author ] . ' (' . round( $touched[ $author ] / $totaltouched * 100, 2 ) . '%) files' . "\n";
- }
- ?>
Add Comment
Please, Sign In to add comment