Web Programming: We know how to use PHP to write server-side script to tell web
ID: 3920005 • Letter: W
Question
Web Programming:
We know how to use PHP to write server-side script to tell web server what to do. We know how to use JavaScript to write client-side script to tell the web browser what to do. In fact, some interactivities such as user input validation, can be written either in PHP or JavaScript.
In your opinion, when would it be more appropriate to use JavaScript or PHP or does it matter which one to use? Support your argument with examples. No actual JavaScript or PHP codes required. As a web developer, why is it important to learn both JavaScript and PPH?
Explanation / Answer
As a web devloper we need scripting to be performed at the server side and client
side.As specified in the quetsion itself PHP is mostly used for servide scripting and
Javacript is mostly used for client side scripting.So they both are important and should be known to the web developer.Both the scripts provides specific features for their
usage at their respective ends.Javacript on the client side provides:
1.It makes web pages interactive.
2.It doesn't require constant downloads from corresponding website.
3.AJAX (Asynchronous JavaScript and XML) enables web browsers to interact asynchronously with the web server. Using AJAX, webpages get updated in the background without reloading and refreshing the webpage. This means the users’ surfing experience is not only uninterrupted but also dynamic because the content of the webpage is continuously updating to the newest version.
PHP provides:
1.Better performance (faster internet pipe, faster connection to data sources, etc...)
2.Faster access to server-side data
3.Easier to secure and control access to data server-side than client-side
4.Fewer cross-browser issues
5.Smaller pages for browser to download
6.Same server logic can be exposed via XML or a JSON-type API
Actually there is not much comparison for choosing javascript or PHP as both are
meant for different purposes. Looking at the above features we can say that in order
to develop better web applications we need to have good knowledge of javascrpit (client
side scripting) and PHP (server side scripting).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.