PHP code example of rinaldi / horspool

1. Go to this page and download the library: Download rinaldi/horspool library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rinaldi / horspool example snippets



use Rinaldi\Horspool\Horspool;
use Rinaldi\Horspool\ShiftTable;

$string = "Hello Word";
$patterm = "ello";

$shitfTabel = ShiftTable::shifting($patterm);

$result = Horspool::search($patterm,$shitfTabel,$string);

if($result >0){
    echo "Pola ditemukan";
}else{
    echo 'Pola tidak ditemukan';
}