JavaScript or PHP?

Discussion in 'Scripts' started by marktaylor, Mar 6, 2016.

to remove all ads.
  1. marktaylor

    marktaylor New Member

    If I want to build a dynamic website, should I use JavaScript or PHP? Which one is better?
  2. chrishirst

    chrishirst 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.
  3. zuan1

    zuan1 New Member

    I think Php is best for to create a dynamic website.....
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Depends on how you define 'dynamic website'
    PHP requires that a request to the server is made to change anything.

    Javascript does not.
    christian jude cuyos likes this.
  5. Mark Spidle

    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
  6. Dennis Carnegie Jr

    Dennis Carnegie Jr New Member

    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.

Share This Page