Wednesday, 5 March 2008

first glance at PHP vs JavaScript

So far, I did some javascript programming, and found out something javascript really can not do.

  1. javascript is a technique for web"page". So all it can control are only 'window' and 'document'. So its output normally are only 'alert' and 'document.write()'. In this case, no way to redirect any inforamtion to anywhere else.
  2. PHP is a kind of programming language, quite unix like. It can work in the way of command line, this means, it can redirect its variables to another variable or stream to anywhere else. It use 'echo' to output and as a return for command line programming, this is how so many websites using php pluse some parametres as src of javascript. Because PHP can redirect formatted .js contents to the "src=", in this way, a dynamic .js can be created. While javascript can not do that, because all javascript output goes to 'document', as a html formatted contents can not be used as .js file.

No comments:

My photo
London, United Kingdom

Facebook & Twitter