Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between HTML and PHP

Tags:

html

php

I know that HTML is viewed on the client side and PHP is on the server side. I guess I want to know why they use different things. Why doesn't the client just view a php file?

like image 558
Alex Avatar asked Jun 08 '10 16:06

Alex


People also ask

How is PHP different from HTML?

PHP is used for server-side programming which will interact with databases to retrieve information, storing, email sending, and provides content to HTML pages to display on the screen. HTML is used for specifying colors, text formatting, aligning, etc. PHP is easy to learn but not as much as HTML.

What is the relation between PHP and HTML?

PHP is a server-side programming language. HTML is a client-side scripting language. PHP is used in backend development, which interacts with databases to retrieve, store, and modify the information. HTML is used in frontend development, which organizes the content of the website.

Why PHP is used in HTML?

PHP (Hypertext Preprocessor) is known as a general-purpose scripting language that can be used to develop dynamic and interactive websites. It was among the first server-side languages that could be embedded into HTML, making it easier to add functionality to web pages without needing to call external files for data.


2 Answers

Because the client doesn't have access to your server :) HTML is the waiter and PHP is the kitchen. You don't want your users going into the kitchen - you want them to order food from the waiter to be prepared by the kitchen.

like image 196
Dan Heberden Avatar answered Oct 24 '22 05:10

Dan Heberden


PHP is like the company that generates the HTML, so you have a PHP script that does a lot of tasks, consulting a database, filtering stuff, adding things, and after it completes the task, it generates a cool little HTML code that is the one that the browser is able to render.

So ASP, PHP, Java, RUby and everything else, works on the server to generate a HTML, so your browser can identify it

like image 45
camilo_u Avatar answered Oct 24 '22 07:10

camilo_u