Q:

How to perform this array filtering without using any function in PHP?

Let's say I have
$a = [1,4,5,8,9,...];

well containing a large range of discontinuing numbers, and
$p = [
  1 => [...],
  3 => [...],
  8 => [...],
  10 => [...],
  ...
];

containing arrays which indexes are discontinued as well.
I need to remove every number in $a that has a corresponding index in $p ...wait... without using any function.
Is it possible ? If yes, how ? If no, what is the most optimized way (wallclock-wise) to resolve that ?

A:

Sure, it's possible:
$filtered_array = [];
foreach ($a as $index => $value) {
    foreach ($p as $key => $sub_array) {
        if ($key == $value) {
            // this $value of $a corresponds with an existing index in $p, so
            // do NOT add it to our $filtered_array but move on to the next
            // value of $a
            continue 2;
        }
    }
    $filtered_array[$index] = $value;
}

Of course this will be very slow since for every entry in $a that is not in $p you will need to iterate over the entire $p array to find out that it isn't in there. A more efficient solution would be to leverage PHP's OutOfBoundsException that is thrown when you try to access an array index that doesn't exist:
$filtered_array = [];
foreach ($a as $index => $value) {
    try {
        $p[$value];
    } except (OutOfBoundsException $e) {
        // $value does not exist as an index of $p
        $filtered_array[$index] = $value;
    }
}

Performance might be improved somewhat if you don't need to preserve the array keys (you won't need $index in that case, which saves a memory assignment for every item in $a), but I think that difference will be negligible.
Using some array functions will be more efficient:
$filtered_array = [];
foreach ($a as $index => $value) {
    if (!array_key_exists($value, $p)) {
        $filtered_array[$index] = $value;
    }
}

Since you won't need a try/catch mechanism that passes through PHP's error handling, this will be faster.
It would probably be even faster if you allow yourself to use unset() to remove values that are in $p, so you don't need to create a new array but can instead modify $a in place. From your code example and the short array syntax, I'm assuming you use PHP 7. Since PHP 7 no longer uses the internal array pointer for foreach, you can safely unset() items while iterating. If you're running on PHP 5, you can still do that but you run the risk of foreach skipping over some items.
foreach ($a as $index => $value) {
    if (array_key_exists($value, $p)) {
        unset($a[$index]);
    }
}

Doing this will reduce the memory overhead of having a second (potentially large) array hanging around.
But since now you're already breaking your own "no functions" rule anyway, you might as well go all the way and use array_filter (although this does not modify the existing array but instead builds a new array, which will degrade performance for very large arrays):
$filtered_array = array_filter($a, function($value) use ($p) {
    return !array_key_exists($value, $p);
});

