<?php 

$data = "Output: ************************************************************************* Welcome to ZXAN product C320 of ZTE Corporation ************************************************************************* Last login time is 03.28.2005-09:25:37-UTC, 0 authentication failures happened since that time. % The password is not strong, please change the password. ZXAN>enable Password: ZXAN#config t %Info 20272: Enter configuration commands, one per line. End with CTRL/Z. ZXAN(config)#show running-config interface gpon-olt_1/1/1 Building configuration... interface gpon-olt_1/1/1 no shutdown linktrap disable description sitiSaadah name sitiSaadah onu 2 type HG8245H sn HWTC2F363F9B onu 3 type ALL-GPON sn ZTEGCB990147 onu 4 type ALL-GPON sn ZTEGCC61ADCC onu 5 type ALL-GPON sn HWTC743FF334 onu 6 type ALL-GPON sn ZTEGCCB7D146 onu 7 type ALL-GPON sn ZTEGCD86CD90 onu 8 type HG8245H sn HWTC4182FA5A onu 9 type ALL-GPON sn CIOT14B97DD8 onu 10 type ALL-GPON sn HWTCA2BAC29C onu 11 type ALL-GPON sn ZTEGCD804969 onu 12 type ALL-GPON sn HWTC7A11C7AA onu 13 type ALL-GPON sn ZTEGCD8776FF onu 14 type ALL-GPON sn HWTC8E801A3D onu 15 type ALL-GPON sn ZTEGCCC5FD29 onu 16 type ALL-GPON sn ZTEGCAADF73A onu 17 type ALL-GPON sn ZTEGCACA9E10 onu 18 type ALL-GPON sn ZTEGCCBFACDB --More-- onu 19 type ALL-GPON sn ZTEGCD8AB707 onu 22 type ALL-GPON sn ZTEGCCC918B4 onu 23 type ALL-GPON sn ZTEGCD845106 onu 24 type ALL-GPON sn ZTEGCD14B6CB onu 25 type ALL-GPON sn RCMG3B205A0E onu 26 type ALL-GPON sn ZTEGCD6B8338 onu 27 type ALL-GPON sn ZTEGCD0C8470 onu 28 type ALL-GPON sn ZTEGCE640578 onu 29 type ALL-GPON sn ZTEGCAC9738B onu 30 type ALL-GPON sn ZTEGCD8333AE onu 31 type ALL-GPON sn ZTEGCD8759DF onu 32 type ALL-GPON sn ZTEGCCC25E3F onu 33 type ALL-GPON sn ZICG11BF7DA9 ! end ZXAN(config)#";

// Buat array dari "onu 1" hingga "onu 40"
$allOnu = [];
for ($i = 1; $i <= 40; $i++) {
    $allOnu[] = "onu $i";
}

// Temukan semua "onu" yang ada dalam string $data
preg_match_all('/onu \d+/', $data, $matches);
$dataArray = $matches[0];

// Cari mana yang tidak ada di dalam $data
$missingOnu = array_diff($allOnu, $dataArray);

// Tampilkan hasil
foreach ($missingOnu as $onu) {
    echo "$onu tidak ada di string.<br>";
}
?>
