google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: PHP

Tuesday, July 22, 2014

PHP

PHP

  1. PHP is a recursive acronym for "Hypertext Preprocessor".
  2. PHP is a widely-used, open source scripting language.
  3. PHP scripts are executed on the server.
  4. PHP costs nothing, it is free to download and use.
  5. PHP files can contain text, HTML, CSS, JavaScript, and PHP code.
  6. PHP code are executed on the server, and the result is returned to the browser as plain HTML.
  7. PHP files have extension ".php".
  8. PHP can generate dynamic page content.
  9. PHP can create, open, read, write, delete, and close files on the server.
  10. PHP can collect form data.
  11. PHP can send and receive cookies.
  12. PHP can add, delete, modify data in your database.
  13. PHP can restrict users to access some pages on your website.
  14. PHP can encrypt data.
  15. PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.).
  16. PHP is compatible with almost all servers used today (Apache, IIS, etc.).
  17. PHP supports a wide range of databases.
  18. PHP is easy to learn and runs efficiently on the server side.
  19. With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies.
  20. You can also output any text, such as XHTML and XML.
  21. In PHP, all user-defined functions, classes, and keywords (e.g. if, else, while, echo, etc.) are NOT case-sensitive.However; in PHP, all variables are case-sensitive.
  22. PHP is a Loosely Typed Language.PHP automatically converts the variable to the correct data type, depending on its value.In other languages such as C, C++, and Java, the programmer must declare the name and type of the variable before using it.


PHP Variables:-

As with algebra, PHP variables can be used to hold values (x=5) or expressions (z=x+y).

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Rules for PHP variables:
  1. A variable starts with the $ sign, followed by the name of the variable
  2. A variable name must start with a letter or the underscore character
  3. A variable name cannot start with a number
  4. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  5. Variable names are case sensitive ($y and $Y are two different variables)



PHP Variables Scope:-

In PHP, variables can be declared anywhere in the script.

The scope of a variable is the part of the script where the variable can be referenced/used.

PHP has three different variable scopes:
  1. local
  2. global
  3. static

PHP Data Types:-
PHP Integers:

An integer is a number without decimals.

Rules for integers:

  1. An integer must have at least one digit (0-9)
  2. An integer cannot contain comma or blanks
  3. An integer must not have a decimal point
  4. An integer can be either positive or negative
  5. Integers can be specified in three formats: decimal (10-based), hexadecimal (16-based - prefixed with 0x) or octal (8-based - prefixed with 0)

Example
<?php
$x = 5985;
var_dump($x);
echo "<br>";
$x = -345; // negative number
var_dump($x);
echo "<br>";
$x = 0x8C; // hexadecimal number
var_dump($x);
echo "<br>";
$x = 047; // octal number
var_dump($x);
?>

Basic PHP Syntax:-
A PHP script can be placed anywhere in the document.
A PHP script starts with <?php and ends with ?>

Example:

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>

</body>
</html>

PHP statements are terminated by semicolon (;).
The closing tag of a block of PHP code also automatically implies a semicolon.
So you do not have to have a semicolon terminating the last line of a PHP block.

रामायण

रामायण दशरथ की तीन पत्नियाँ – कौशल्या, सुमित्रा , कैकेयी दशरथ के चार पुत्र – राम,लक्ष्मण,भरत,शत्रुघ्न दशरथ: राम के पिता और कौशल के राजा कौशल...