Replacing is_a with instanceof.

is_a was deprecated in PHP 5, 5.1, and 5.2. Then it was undeprecated. We can use instanceof achieve the same thing. So here we are.

Fixes #2446.