Well both PHP Scripting and JavaScript are totally used in different domains in web technologies. PHP is 100% used in Server side scripting for generating dynamic contents for web pages and JavaScript is almost totally (except nodejs) used in web clients (browsers) to provide dynamism to web pages on the client software itself.
As far as security implementation is concerned, both the languages are fully dependent on the developer and his/her wisdom and experience against the attackers wisdom and exp.
Functionally, both are at No. 1 position in their own domains.
Thank you
Both are not the same thing. So, you need to different the usage so we shall know how to answer the question. You can design an application using PHP without Javascript and the same time you can design Javascript application without PHP. And, both can be used for an application.