<?php
include 'wilayah_indonesia_array_flat.php';

$keyword = strtolower($_POST['keyword'] ?? '');
$limit   = 5;
$count   = 0;

if ($keyword === '') {
    exit;
}

foreach ($keperluan as $w) {
    if (stripos($w, $keyword) !== false) {
        echo '<a href="#" class="list-group-item keperluan-items">'.$w.'</a>';
        $count++;
        
        if ($count >= $limit) {
            break;
        }
    }
}
