PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Khaled Al-Shamaa  >  ArCharsetD  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArCharsetD
Guess the character set of an Arabic text
Author: By
Last change:
Date: 9 years ago
Size: 769 bytes
 

Contents

Class file image Download
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"></head><body>
<ul>
<?php
   
include('ArCharsetD.class.php');
   
$ard = new ArCharsetD();

   
$dir = 'folder/';

    if (
$dhandle = opendir($dir)) {
        while (
false !== ($file = readdir($dhandle))) {
            if (
$file != "." && $file != "..") {
               
// get contents of a file into a string
               
$fhandle = fopen($dir.$file, "r");
               
$contents = fread($fhandle, filesize($dir.$file));
               
fclose($fhandle);

               
$charset = $ard->getCharset($contents);
                echo
"<li>$file (<i>$charset</i>)</li>";
            }
        }
       
closedir($dhandle);
    }
?>
</ul>
</body></html>