JNTU B Tech CSE Materials: PHP

Search here!...

JKDIRECTORY
Plant Trees! Recreate Lakes,Ponds! Save Energy!


Now! You can Upload your Files! (NO LOGIN REQUIRED)
Here!

PHP

AVOID USE OF PLASTICS (Polythin)to serve the nation

Please Plant Trees ! Save Trees !

Stop Ignition while you are near the signals!

Information on PHP
  • PHP development began in 1994 when the developer Rasmus Lerdorf wrote a series of Common Gateway Interface (CGI) Perl scripts, which he used to maintain his personal homepage. 

  • The tools performed tasks such as displaying his résumé and recording his web traffic.

  • He rewrote these scripts in C for performance reasons, extending them to add the ability to work with web forms and to communicate with databases, and called this implementation "Personal Home Page/Forms Interpreter" or PHP/FI.

  • PHP/FI could be used to build simple, dynamic web applications.

  • Lerdorf initially announced the release of PHP/FI as "Personal Home Page Tools (PHP Tools) version 1.0" publicly to accelerate bug location and improve the code, on the comp.infosystems.www.authoring.cgi Usenet discussion group on June 8, 1995.

  • This release already had the basic functionality that PHP has as of 2013.

  • This included Perl-like variables, form handling, and the ability to embed HTML.

  • The syntax resembled that of Perl but was more limited and simpler, although less consistent.

  • A development team began to form and, after months of work and beta testing, officially released PHP/FI 2 in November 1997.

  • Zeev Suraski and Andi Gutmans rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to the recursive acronym PHP: Hypertext Preprocessor.

  • Afterward, public testing of PHP 3 began, and the official launch came in June 1998.

  • Suraski and Gutmans then started a new rewrite of PHP's core, producing the Zend Engine in 1999.

  • They also founded Zend Technologies in Ramat Gan, Israel.

  • On May 22, 2000, PHP 4, powered by the Zend Engine 1.0, was released.

  • As of August 2008 this branch reached version 4.4.9.

  • PHP 4 is no longer under development nor will any security updates be released.

  • On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II.

  • PHP 5 included new features such as improved support for object-oriented programming, the PHP Data Objects (PDO) extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements.







  • In 2008 PHP 5 became the only stable version under development.


  • Late static binding had been missing from PHP and was added in version 5.3.


  • A new major version has been under development alongside PHP 5 for several years.


  • This version was originally planned to be released as PHP 6 as a result of its significant changes, which included plans for full Unicode support.


  • However, Unicode support took developers much longer to implement than originally thought, and the decision was made in March 2010 to move the project to a branch, with features still under development moved to trunk.


  • Changes in the new code include the removal of register_globals, magic quotes, and safe mode.


  • The reason for the removals was that register_globals had opened security holes by intentionally allowing runtime data injection, and the use of magic quotes had an unpredictable nature.


  • Instead, to escape characters, magic quotes may be replaced with the addslashes() function, or more appropriately an escape mechanism specific to the database vendor itself like mysql_real_escape_string() for MySQL.


  • Functions that will be removed in future versions and have been deprecated in PHP 5.3 will produce a warning if used.


  • Many high-profile open-source projects ceased to support PHP 4 in new code as of February 5, 2008, because of the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.


  • PHP interpreters are available on both 32-bit and 64-bit operating systems, but on Microsoft Windows the only official distribution is a 32-bit implementation, requiring Windows 32-bit compatibility mode while using Internet Information Services (IIS) on a 64-bit Windows platform.


  • Experimental 64-bit versions of PHP 5.3.0 were briefly available for Microsoft Windows, but have since been removed.


  • The following Hello world program is written in PHP code embedded in an HTML document:

  • <!DOCTYPE html>
    <meta charset="utf-8">
    <title>PHP Test</title>
    <?php
    echo 'Hello World';
    ?>


  • However as PHP does not need to be embedded in HTML, or used with a web server, the simplest version of a Hello World program can be written like this:

  • <?= 'Hello world';


  • The PHP interpreter only executes PHP code within its delimiters. Anything outside its delimiters is not processed by PHP (although non-PHP text is still subject to control structures described in PHP code).


  • The most common delimiters are <?php to open and ?> to close PHP sections. <script language="php"> and </script> delimiters are also available, as are the shortened forms <? or <?= (which is used to echo back a string or variable) and ?> as well as ASP-style short forms <% or <%= and %>.


  • While short delimiters are used, they make script files less portable as support for them can be disabled in the PHP configuration. The purpose of all these delimiters is to separate PHP code from non-PHP code, including HTML.


  • The first form of delimiters, <?php and ?>, in XHTML and other XML documents, creates correctly formed XML 'processing instructions'.


  • This means that the resulting mixture of PHP code and other markup in the server-side file is itself well-formed XML.


  • Variables are prefixed with a dollar symbol, and a type does not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted ("") and heredoc strings provide the ability to interpolate a variable's value into the string.

  • Note:


  • A here document (also called a here-document, a heredoc, a hereis, a here-string or a here-script) is a way of specifying a string literal in command line shells including Unix shells (sh, csh, ksh, Bash and zsh) and in programming or scripting languages such as Perl, PHP, Python, PowerShell and Ruby.


  • It preserves the line breaks and other whitespace (including indentation) in the text. Some languages allow variable substitution and command substitution inside the string.


  • The most common syntax for here documents is << followed by a delimiting identifier, followed, starting on the next line, by the text to be quoted, and then closed by the same identifier on its own line.


  • Under the UNIX shells, here documents are generally used as a way of providing input to commands.


  • The echo statement is one of several facilities PHP provides to output text, e.g., to a web browser.


  • In terms of keywords and language syntax, PHP is similar to most high level languages that follow the C style syntax. if conditions, for and while loops, and function returns are similar in syntax to languages such as C, C++, C#, Java and Perl.

  • DATA TYPES:


  • PHP stores whole numbers in a platform-dependent range, either a 64-bit or 32-bit signed integer equivalent to the C-language long type. Unsigned integers are converted to signed values in certain situations; this behavior is different from other programming languages.


  • Integer variables can be assigned using decimal (positive and negative), octal, hexadecimal, and binary notations. Floating point numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation.


  • PHP has a native Boolean type that is similar to the native Boolean types in Java and C++. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++.


  • The null data type represents a variable that has no value. The only value in the null data type is NULL.


  • Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources.


  • Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled.


  • PHP also supports strings, which can be used with single quotes, double quotes, and nowdoc or heredoc syntax.


  • The Standard PHP Library (SPL) attempts to solve standard problems and implements efficient data access interfaces and classes.

    FUNCTIONS:


  • PHP has hundreds of base functions and thousands more via extensions. These functions are well documented on the PHP site; however, the built-in library has a wide variety of naming conventions and inconsistencies.


  • PHP currently has no functions for thread programming, although it does support multi process programming on POSIX systems.


  • Additional functions can be defined by a developer:

  • function myFunction() { // declares a function, this is named myFunction
    return 'John Doe'; // returns the value 'John Doe'
    }
    echo 'My name is ' . myFunction() . '!'; //outputs the text concatenated with //the return value of myFunction.
    // myFunction is called as a result of this syntax.
    // The result of the output will be
    'My name is John Doe!'


  • In PHP 5.2 and earlier, functions are not first-class functions and can only be referenced by their name, directly or dynamically by a variable containing the name of the function.


  • User-defined functions can be created at any time without being prototyped.


  • Functions can be defined inside code blocks, permitting a run-time decision as to whether or not a function should be defined. Function calls must use parentheses, with the exception of zero argument class constructor functions called with the PHP new operator, where parentheses are optional. PHP supports quasi-anonymous functions through the create_function() function, although they are not true anonymous functions because anonymous functions are nameless, but functions can only be referenced by name, or indirectly through a variable $function_name();, in PHP.


  • PHP gained support for closures in PHP 5.3. True anonymous functions are supported using the following syntax:

  • function getAdder($x) {
    return function($y) use ($x) {
    return $x + $y;
    };
    }
    $adder = getAdder(8);
    echo $adder(2); // prints "10"



  • Here, the getAdder() function creates a closure using the parameter $x (the keyword use imports a variable from the lexical context), which takes an additional argument $y and returns it to the caller. Such a function is a first class object, meaning that it can be stored in a variable, passed as a parameter to other functions, etc.


  • The goto flow control statement is used as follows:

  • function lock() {
    $file = fopen('file.txt', 'r+');
    retry:
    if (!flock($file, LOCK_EX | LOCK_NB)) {
    goto retry;
    }
    fwrite($file, 'Success!');
    fclose($file);
    }


  • When flock() is called, PHP opens a file and tries to lock it. The target label retry: defines the point to which execution should return if flock() is unsuccessful and goto retry; is called.


  • The goto statement is restricted and requires that the target label be in the same file and context.


  • The goto statement has been supported since PHP 5.3

  • OBJECTS:


  • Basic object-oriented programming functionality was added in PHP 3 and improved in PHP 4.


  • Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance.


  • In previous versions of PHP, objects were handled like value types.


  • The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value.


  •  PHP 5 introduced private and protected member variables and methods, along with abstract classes, final classes, abstract methods, and final methods.


  • It also introduced a standard way of declaring constructors and destructors, similar to that of other object-oriented languages such as C++, and a standard exception handling model.


  • Furthermore, PHP 5 added interfaces and allowed for multiple interfaces to be implemented.


  • There are special interfaces that allow objects to interact with the runtime system.


  • Objects implementing ArrayAccess can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the foreach language construct.


  • There is no virtual table feature in the engine, so static variables are bound with a name instead of a reference at compile time.


  • If the developer creates a copy of an object using the reserved word clone, the Zend engine will check if a __clone() method has been defined or not.


  • If not, it will call a default __clone() which will copy the object's properties. If a __clone() method is defined, then it will be responsible for setting the necessary properties in the created object.


  • For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value replica of the source object and only override properties that need to be changed.


  • The following is a basic example of object-oriented programming in PHP:

  • class Person {
    public $firstName;
    public $lastName;
    public function __construct($firstName, $lastName = '')
    { //Optional parameter
    $this->firstName = $firstName;
    $this->lastName = $lastName;
    }
    public function greet() {
    return "Hello, my name is " . $this->firstName . " " . $this->lastName . ".";
    }
    public static function staticGreet($firstName, $lastName) {
    return "Hello, my name is " . $firstName . " " . $lastName . ".";
    }
    }
    $he = new Person('John', 'Smith');
    $she = new Person('Sally', 'Davis');
    $other = new Person('iAmine');
    echo $he->greet(); // prints "Hello, my name is John Smith."
    echo '<br />';
    echo $she->greet(); // prints "Hello, my name is Sally Davis."
    echo '<br />';
    echo $other->greet(); // prints "Hello, my name is iAmine."
    echo '<br/>';
    echo Person::staticGreet('Jane', 'Doe'); // prints "Hello, my name is Jane Doe."


  • The visibility of PHP properties and methods is defined using the keywords public, private, and protected.


  • The default is public, if only var is used; var is a synonym for public. Items declared public can be accessed everywhere, protected limits access to inherited classes (and to the class that defines the item), private limits visibility only to the class that defines the item.


  • Objects of the same type have access to each other's private and protected members even though they are not the same instance. PHP's member visibility features have sometimes been described as "highly useful." However, they have also sometimes been described as "at best irrelevant and at worst positively harmful."

  • Note: PHP includes free and open source libraries with the core build.


  • PHP is a fundamentally Internet-aware system with modules built in for accessing File Transfer Protocol (FTP) servers, many database servers, embedded SQL libraries such as embedded PostgreSQL, MySQL, Microsoft SQL Server and SQLite, LDAP (Lightweight Directory Access Protocol) servers, and others.


  • Many functions familiar to C programmers such as those in the stdio family are available in the standard PHP build.


  • PHP allows developers to write extensions in C to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the Windows API, process management on Unix-like operating systems, multibyte strings (Unicode), cURL, and several popular compression formats.

PICVIDEO

Do u know what is JKDIRECTORY!



to see about "what is JKDIRECTORY !" just click the button

Wallpapers







Over Confidence

Over Confidence
Getting success thru Over Confidence is like writing any thing on sand near by waves

Have Success in your life

Have Success in your life
See how confident they are ... and look at top one size(work) is less but Position (responsibility) is high....but if you see at bottom one it has the more responsibility than the top because with out bottom there is no top one ! so ! Give value to your bottom one's

See Some Facts!

The teeth grow in humans before 6months of his/her born.

The largest swimming pool is located at Chilli in South Africa of 19.77 acres.

If you are right handed, you will tend to chew your food on your right side. If you are left handed, you will tend to chew your food on your left side.

If you stop getting thirsty, you need to drink more water.when a human body is dehydrated, its thirst mechanism shuts off.

Your tongue is germ free only if it is pink. If it is white there is a thin film of bacteria on it.

The Mercedes-Benz motto is “Das Beste oder Nichts” meaning “the best or nothing”.

Know More
© CopyRight Protected.