Web Programming Chapter Five
Web Programming Chapter Five
The acronym PHP refers to Hypertext Preprocessor :- used to create dynamic and interactive websites.
it can contain text, HTML, CSS, JavaScript, and PHP code executed on the server and only the result is
turn back to the end users.
It can create, open, read, write, delete, and close files on the server.
It can collect data from form, and it can send and receive cookies.
It can add, delete, modify data in your database and supports a wide range of databases.
<?php
echo "Hello World!";
?>
HTML pages can be viewed on any computer, directly in a browser where as
PHP scripts must be run on a PHP-enabled Web server.
When we use PHP code together with HTML, PHP codes can be any where.
A variable starts with the $ sign, followed by the name of the variable.
Variable names are case sensitive ($y and $Y are two different variables).
2. Local variables
A variable declared within a function has a LOCAL SCOPE and can only be accessed within
that function.
3. Static variables
Normally, when a function is completed or executed, all of its variables are deleted. However,
sometimes we want a local variable NOT to be deleted. We need it for a further job. To do this, use
the static keyword when you first declare the variable.
Just type the word print, followed by what you want to display: a simple message, the value of a
variable, the result of a calculation, and so forth.
To be clear, print doesn’t actually print anything; it just outputs data. When a PHP script is run
through a Web browser, that PHP output is received by the browser itself.