JavaScript or PHP?

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

to remove all ads.
Tags:
  1. marktaylor

    marktaylor New Member

    Messages:
    10
    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

    Messages:
    2,598
    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

    Thirdly;

    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

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

    chrishirst Well-Known Member Staff Member

    Messages:
    2,598
    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

    Messages:
    6
    usually these are used in conjuction with each other to create AJAX pages. Basically you can create pages that have live elements. See AJAX
     

Share This Page