Если я понимаю ваш вопрос, согласно вашему комментарию , вот что вы пытаетесь сделать:
<?php
$arr = array(1, 2, 3);
if (isset($_GET['id']) && !empty($_GET['id'])) {
// If "id" is set and not empty, do:
$id = $_GET['id'];
if (in_array($id, $arr)) {
// If "id" is in array of available ids
// Page exists
echo "Hello World";
} else {
// Page does not exists
echo "Page does not exists";
}
} else {
// Page does not exists
echo "Page does not exists";
}
Это приведет к:
index.php?id=1 // "Hello World"
index.php?id=27 // Page does not exists
index.php?id= // Page does not exists
index.php // Page does not exists
Я не рекомендую использовать массивы для идентификатора страницы, вместо этого используйте базу данных (mysql / mariadb)