PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Vagharshak Tozalakyan   Project Estimator   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Sample
Class: Project Estimator
Get the number of lines and characters from files
Author: By
Last change:
Date: 17 years ago
Size: 1,152 bytes
 

Contents

Class file image Download
<?php

 
require_once 'estimator.class.php';

 
$pe = new ProjectEstimator();

 
$pe->root = 'C:/shttps/www/library/';
 
$pe->check_subdirs = true;
 
$pe->filters = array("#\.php#i");

 
$pe->getInfo(false);

  echo
'<b>Total number of files:</b> ' . $pe->total_files . '<br />';
  echo
'<b>Total number of lines:</b> ' . $pe->total_lines . '<br />';
  echo
'<b>Total number of characters:</b> ' . $pe->total_size . '<br />';
  echo
'<b>Total number of alphabetic characters:</b> ' . $pe->total_chars . '<br />';
  echo
'<b>Total size in bytes:</b> ' . $pe->total_size . '<br />';
  echo
'<br /><br />';
  echo
'<table border="1">';
  echo
'<tr>';
  echo
'<td width="350"><b>File name</b></td>';
  echo
'<td><b>Num. lines</b></td>';
  echo
'<td><b>Num. chars</b></td>';
  echo
'<td><b>File size</b></td>';
  echo
'</tr>';
  foreach (
$pe->files as $fname)
  {
    echo
'<tr>';
    echo
'<td>' . $fname['file_name'] . '</td>';
    echo
'<td>' . $fname['num_lines'] . '</td>';
    echo
'<td>' . $fname['num_chars'] . '</td>';
    echo
'<td>' . $fname['file_size'] . '</td>';
    echo
'</tr>';
  }
  echo
'</table>';

?>