<?php
include 'wilayah_indonesia_array_flat.php';

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

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

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

        if ($count >= $limit) {
            break;
        }
    }
}
