i would like to know if php can replace javascript as a client side script.

one can use javascript to do all kinds of things like computing values in textboxes and check them for errors and so on. is it possible to use php in its stead?

lets say i want to make the client interactive without it having to go back to the server for each button pressed can i use php instead of javascript? and can i use it without first having to install a web server and php on the client because such a thing would of course be impractical for a project where the client can be somewhere in some internet cafe.

i suppose the question can be summed up in: are web browsers able to use either php or javascript for client side scripting without making any kind of fuss about it needing a web server or an installation of php or anything? this is of course if i only want to learn or use php and not both php and javascript but without me having to go to each internet cafe on earth and installing php on it.

Recommended Answers

All 6 Replies

hey ,

question is full of confusion

sorry. basically can one use php in the place of javascript without having to install php or a web server on the client.

Not really No. PHP is a Server-Side language, and it is processed on the web server before it is pumped down to the client's browser. It will always run off the web server.

JavaScript comes pre-installed on the browser. PHP does not.

thanks guys.

this is the answer i needed. i had to make sure since somebody somewhere and somehow convinced my boss that php is the new heaven on pc so i am stuck with trying to force it to fit into various square holes.

JavaScript is for Client side and PHP is for Server-side. The reason being is that eventhugh both can communicate with eachother to send and receive data, It is only PhP that can communicate with MySQL to retrieve data from it. So Javascript (being the client), can communicate to MySQL through PHP. Thats the connection they can have at the peak of efficiency.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.