PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   ArIdentifier   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ArIdentifier
Identify Arabic text in multi-language documents
Author: By
Last change:
Date: 16 years ago
Size: 516 bytes
 

Contents

Class file image Download
<?php
    $lines
= file('sample.html');
   
$str = implode("\n", $lines);

    include(
'ArIdentifier.class.php');
   
$obj = new ArIdentifier();

   
$pos = $obj->identify($str);

   
$total = count($pos);

    echo
substr($str, 0, $pos[0]);

    for(
$i=0; $i<$total; $i+=2){
        echo
'<span style="BACKGROUND-COLOR: #EEEE80">';
        echo
substr($str, $pos[$i], $pos[$i+1]-$pos[$i]);
        echo
'</span>';
        echo
substr($str, $pos[$i+1], $pos[$i+2]-$pos[$i+1]);
    }
   
?>