Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
A client side language runs in the browser. A browser can interpret Javascript. A server side language executes on the server which then delivers the results to the browser on the client side (in some languages) PHP is a server side language ONLY and cannot be used on the client side as Michael stated.
3rd Nov 2019, 10:04 AM
Xyenia 🦉
Xyenia 🦉 - avatar
+ 2
Xyenia, there is one point where I can agree: My statement may confuse people. (Nevertheless it‘s true) But I cannot agree with your other arguments. 1. PHP does not need a server to be used. I can install PHP on my OS an run my scripts locally. 2. „technically every language can be used on both sides“ is still true... I don‘t see a falseness in this statement. Client- and server side coding is a matter of feasibility for a specific purpose which then could lead to a choice of programming languages. It‘s not primary connected to a limited set of languages.
3rd Nov 2019, 11:16 AM
Michael
Michael - avatar
+ 1
Xyenia, this is a very narrow perspective. Of course PHP is mainly used server sided, but who bans me from using it client sided? Here are two references about this: https://docstore.mik.ua/orelly/webprog/pcook/ch20_01.htm https://atymic.dev/blog/client-side-php/
3rd Nov 2019, 10:20 AM
Michael
Michael - avatar
+ 1
Michael, if you open notepad and type in php code, close and save as Html or php file. Then open the file, the php will not execute. You are getting confused maybe with having a server like WAMP, LAMP, XAMP on your system, which then, would look like you are running your php clientside when infact you are not. Php needs a server to parse and execute. I'm only challenging the part where you stated "technically every language can be used on both sides" - which is incorrect. Edit: I read your links, bundling php into the browser is possible but is limited in use. IMO, it's like trying to reinvent the wheel. Addendum: Also, nothing stops you from taking an approach in trying to make a server side language a client side language. That is your choice, but, it confuses people (new users), giving them this advanced answer when they are at grassroots level learning what are known as the standard definitions of server side and client side. Exploration and muddying of the waters can come later if they choose.
3rd Nov 2019, 10:34 AM
Xyenia 🦉
Xyenia 🦉 - avatar
+ 1
Xyenia, I completely agree with you. My only point I am after is critically questioning this black-and-white way of thinking: "There are server side languages which are ONLY for server side scripting and there are client side languages which are ONLY for client side scripting." A prime example is JavaScript. It is used as client side programming language by 95% of all the websites (https://w3techs.com/technologies/details/cp-javascript/all/all). On the other hand JavaScript is also used server side by about 1% of all the websites (https://w3techs.com/technologies/details/pl-js/all/all). So you can't say JavaScript is ONLY a client side language. It's indeed all just a matter of terminology :-)
3rd Nov 2019, 5:47 PM
Michael
Michael - avatar
0
Michael. Yes, in a very technical way, I may agree with you. But look at this way in simple terms. A developer builds his website and uses php. Months go by and his website is very popular all over the world. Now, let's say, he is able to switch off the php interpreter on the server, but leave all his php code inside his files. My question: how many users around the world will have a conduit / php intrepreter in place to execute the php on their client side? So, yes for you, your php can be clientside with php installed. But for the majority of users and developers across the world (not advanced niche developers), php is fundamentally a server side language that is executed for users all around the world with no fancy helper programs on their computers, devices or phones.
3rd Nov 2019, 11:36 AM
Xyenia 🦉
Xyenia 🦉 - avatar
0
سلام
7th Nov 2019, 4:13 AM
اسد امیدی
اسد امیدی - avatar
- 1
It is not a matter of a specific programming language. It‘s about where the script is running. Technically every language can be used on both sides.
3rd Nov 2019, 9:55 AM
Michael
Michael - avatar