"What is the advantage of using CDML and then php?"
You can reformat data, perform calculations, suppress redundant data, color alternating rows, merge in data from another (non-FMP) data source, make use of PHP session data, work around the flaky email functionality in Web Companion, implement file upload, etc.
Even better, start with PHP in the first place and build a more secure and flexible system than you could with CDML. CDML has improved since 4.0 but is still quite limited compared to PHP/ASP/Lasso/CFM/Perl.