Need some basic enlightenment about using PHP
To figure out whether you have several PHP installed, you may try to run from shell:

$ which php -a

If you got one - then you are fine.

If you discovered, that the first line goes not the one which you installed, ensure that you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:

PATH="/usr/local/bin:$PATH"
and questions #3: it seems you are confused. XAMPP already includes Apache, so you don't need to install anything separately. XAMPP is an Apache distribution containing MariaDB, PHP, and Perl. You may add xdebug to XAMPP package, by reading one of tutorials for OSX.