What is php
PHP is a open source scripting language .It stands for hypertext preprocessor . Hypretext Preprocessor means it is not processed after loading on web browser , but it is processed on web server before loading on web browser .
It is a server-side scripting language designed for web development but also used as a general-purpose programming language.
It is used for embed into HTML language during web development . It is widely used language for web development .
Alternative of HTML ?
It is not alternative of HTML . It is supporting language of HTML . Hypertext codes are inserted into HTML .
When user write any preprocessor code in HTML webpage then it must be saved as .php format .
How To Run
User can’t run this file directly on web browser just as .html is running . It required web server to run .
It means user needs to install a web server such as Apache , MySQL , IIS server to run PHP on local computer .PHP code is transformed into HTML before the page is loaded, users cannot view its code on webpage .
When PHP code runs on server ,server read this code and return result as simplified html code to web browser .
Syntax starts with “< ?php “sign and ends with “?> “sign . Sample code as follows
<?php <!--code placed here--> ?>
<!DOCTYPE html> <html> <body> <div> <?php echo ("This text is displayed using hypertext preprocessor code"); ?> </div> </body> </html>
In this example code is embedded in html .
<?php echo ("This text is displayed using hypertext preprocessor code"); ?>
This code is processed on web server and send output to web browser and text is displayed “This text is displayed using php code” . echo() function is used to display content.
Difference between HTML and PHP
There is a huge difference between HTML And This language .
- Basic difference is , PHP runs or processed only on server, so user can’t read the source code ,But HTML code completes readable by the web browser .
- Second and confusing difference is PHP code is may be a part of HTML page or code inserted in html code . So it is not alternative of HTML language
- Managing database with PHP is more secure than html ,because database source can’t be tracked easily in it .
- User can create more dynamic , versatile and easy to handle content using PHP , but with html ,user can’t create easily handy webpages .