PHP Classes

File: example.php

Recommend this page to a friend!
  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: 18 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>