/** * Gets a computer by its ip and port. * @param $ip string The ip address of the computer. * @param $port int The computer's port. * @return mixed[] An array of the computer's data. */ function getComputerByIp($ip, $port = 80) { $computers = loadComputers(); foreach ($computers as $computer) { if ($computer["ip"] == $ip && $computer["port"] == $port) { return $computer; } } return null; }
<?php require __DIR__ . "/functions.php"; $computers = loadComputers(); foreach ($computers as $computer) { listComputer($computer); } includeScript(); includeStyles();