Are you sure of the first example? I have never seen that before, since the integer keyword is used in typecasting to integer.
That helps you to recapture the purpose of the variable when you or others visit the code later.
To capture the purpose of a variable, give it a more descriptive name than $a, and use a comment for further explanation if necessary.
Consider:
$a = 5;
It is clear that $a holds an integer (at least at this point). The purpose of this integer, on the other hand, is unknown. Let us switch to C (or C++ etc) for a moment:
int a = 5;
It is clear that a is an int (integer), and this is something like what you are trying to do. Nonetheless, the purpose of a remains unknown. Let us switch back to PHP:
$score = 5;
Now, we can infer from the name that $score holds some sort of score. Since it has been initialised to an integer, we know it is not a music score, and by looking at the surrounding code, we can more easily determine that it is say, the score of a player for a game, better than if we only had $a to work with.
I need to provide a similar functionality in my library, where users can enter elements in an array using keys, but retrieve it later using numeric indexes in the order in which they were entered.
If you do not actually need the original keys, then just store it as a numerically indexed array, discarding the keys. Alternatively, you can say, duplicate the array, for the two sets of keys, or perhaps make it two dimensional with the inner array consisting of a pair (the associative key, and the value).