PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Alex Fourth   Binary search   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Example how to use the class
Class: Binary search
Search for data in files using binary search
Author: By
Last change:
Date: 16 years ago
Size: 386 bytes
 

Contents

Class file image Download
<?php

include 'binary_search.class.php';

$token = 'Zorita Wilkinson2';
try
{
 
$email = BinarySearch::find( 'data.csv', $token );
}
catch(
Exception $e)
{
   echo
'Exception: ' . htmlspecialchars( $e->getMessage() ) . '<hr/>';
}

if( empty(
$email ) )
{
  echo
'Sorry, email of ' . $token . ' was not found';
}
else
{
  echo
'Email of ' . $token . ': ' . $email;
}