Mobile app version of vmapp.org
Login or Join
Gail5422790

: Does browser understand PHP? I know that PHP is server side scripting language, but I got confused when asked in an interview if the browser understands PHP? I have Apache installed in my system.

@Gail5422790

Posted in: #Browsers #Php

I know that PHP is server side scripting language, but I got confused when asked in an interview if the browser understands PHP?

I have Apache installed in my system.

If in a PHP file I write <?php echo 'HELLO' ?> and I open it in a browser it shows HELLO.

Now how does it happen if the browser does not understand PHP?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gail5422790

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

The browser does not understand PHP. Like you have stated, it is a server-side scripting language.

If you are seeing 'HELLO' output in the browser then your script must have been run through the PHP interpreter on the webserver and the resulting output (ie. 'HELLO') is returned in the response that is sent to the browser.

However, if your PHP script is in an ordinary HTML file (that is not parsed by the PHP interpreter) or not located on a webserver with PHP installed then you will not see anything output in the browser in this instance. If you viewed the source of your page you would see the unprocessed PHP code.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme