JavaScript or PHP?


Well-Known Member
Staff member
Neither is "better". They are BOTH completely and entirely different to each other.

PHP is server-side code

javascript is client-side code

And depending on what you call 'dynamic' you will probably need both, along with HTML, CSS and some SQL code


You cannot 'build' a website using PHP and/or javascript, a 'website' is a collection of HTML documents, you can create the HTML documents using PHP code, and you can alter the pages "on the fly" (dynamically) with javascript, but javascript needs the HTML document structure to exist first.

Mark Spidle

New Member
usually these are used in conjuction with each other to create AJAX pages. Basically you can create pages that have live elements. See AJAX
PHP, in my opinion is better than javascript and it provides a faster loading time for the website. I use php for all my sites, and just run includes on my pages to include only part of the pages that I am wanting to display so I create a great layout with a menu, and the menu never changes from page to page. I also use my database to be able to change parts of the website instead of always having to upload changed versions of the pages, it is easier that way.