Misplaced Pages

PHP

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

PHP is a general-purpose scripting language geared towards web development . It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. PHP was originally an abbreviation of Personal Home Page , but it now stands for the recursive acronym PHP: Hypertext Preprocessor .

#353646

117-503: PHP code is usually processed on a web server by a PHP interpreter implemented as a module , a daemon or a Common Gateway Interface (CGI) executable. On a web server, the result of the interpreted and executed PHP code—which may be any type of data, such as generated HTML or binary image data—would form the whole or part of an HTTP response. Various web template systems , web content management systems , and web frameworks exist that can be employed to orchestrate or facilitate

234-632: A just-in-time (JIT) compiler. Because of the significant changes, the reworked Zend Engine was called Zend Engine 3 , succeeding Zend Engine 2 used in PHP ;5. Because of the major internal changes in phpng, it must receive a new major version number of PHP, rather than a minor PHP 5 release, according to PHP's release process. Major versions of PHP are allowed to break backward-compatibility of code and therefore PHP 7 presented an opportunity for other improvements beyond phpng that require backward-compatibility breaks. In particular, it involved

351-422: A web browser or web crawler , initiates communication by making a request for a web page or other resource using HTTP, and the server responds with the content of that resource or an error message . A web server can also accept and store resources sent from the user agent if configured to do so. The hardware used to run a web server can vary according to the volume of requests that it needs to handle. At

468-412: A certain length, or cannot accept a seed (i.e. allow double hashing) is less useful than one that does. A hash function is applicable in a variety of situations. Particularly within cryptography, notable applications include: A hash procedure must be deterministic —for a given input value, it must always generate the same hash value. In other words, it must be a function of the data to be hashed, in

585-407: A constant can be inverted to become a multiplication by the word-size multiplicative-inverse of that constant. This can be done by the programmer, or by the compiler. Division can also be reduced directly into a series of shift-subtracts and shift-adds, though minimizing the number of such operations required is a daunting problem; the number of machine-language instructions resulting may be more than

702-450: A divisor M which is a prime number close to the table size, so h ( K ) ≡ K (mod M ) . The table size is usually a power of 2. This gives a distribution from {0, M − 1} . This gives good results over a large number of key sets. A significant drawback of division hashing is that division requires multiple cycles on most modern architectures (including x86 ) and can be 10 times slower than multiplication. A second drawback

819-453: A dozen and swamp the pipeline. If the microarchitecture has hardware multiply functional units , then the multiply-by-inverse is likely a better approach. We can allow the table size n to not be a power of 2 and still not have to perform any remainder or division operation, as these computations are sometimes costly. For example, let n be significantly less than 2 . Consider a pseudorandom number generator function P (key) that

936-425: A feasible amount of storage space searchable in a bounded amount of time regardless of the number of keys. In most applications, the hash function should be computable with minimum latency and secondarily in a minimum number of instructions. Computational complexity varies with the number of instructions required and latency of individual instructions, with the simplest being the bitwise methods (folding), followed by

1053-403: A hash function are called hash values , hash codes , hash digests , digests , or simply hashes . The values are usually used to index a fixed-size table called a hash table . Use of a hash function to index a hash table is called hashing or scatter-storage addressing . Hash functions and their associated hash tables are used in data storage and retrieval applications to access data in

1170-404: A hash function which takes two parameters—the input data z , and the number n of allowed hash values. A common solution is to compute a fixed hash function with a very large range (say, 0 to 2  − 1 ), divide the result by n , and use the division's remainder . If n is itself a power of 2 , this can be done by bit masking and bit shifting . When this approach is used,

1287-634: A hash function, the uniformity of the distribution of hash values can be evaluated by the chi-squared test . This test is a goodness-of-fit measure: it is the actual distribution of items in buckets versus the expected (or uniform) distribution of items. The formula is ∑ j = 0 m − 1 ( b j ) ( b j + 1 ) / 2 ( n / 2 m ) ( n + 2 m − 1 ) , {\displaystyle {\frac {\sum _{j=0}^{m-1}(b_{j})(b_{j}+1)/2}{(n/2m)(n+2m-1)}},} where n

SECTION 10

#1732765188354

1404-896: A hash table, a hash function takes a key as an input, which is associated with a datum or record and used to identify it to the data storage and retrieval application. The keys may be fixed-length, like an integer, or variable-length, like a name. In some cases, the key is the datum itself. The output is a hash code used to index a hash table holding the data or records, or pointers to them. A hash function may be considered to perform three functions: A good hash function satisfies two basic properties: it should be very fast to compute, and it should minimize duplication of output values ( collisions ). Hash functions rely on generating favorable probability distributions for their effectiveness, reducing access time to nearly constant. High table loading factors, pathological key sets, and poorly designed hash functions can result in access times approaching linear in

1521-400: A list of shapes, similar images in an image database , and so on. Hash tables are also used to implement associative arrays and dynamic sets . A good hash function should map the expected inputs as evenly as possible over its output range. That is, every hash value in the output range should be generated with roughly the same probability . The reason for this last requirement is that

1638-1064: A long time and so Apache suffered, even more, the competition of commercial servers and, above all, of other open-source servers which meanwhile had already achieved far superior performances (mostly when serving static content) since the beginning of their development and at the time of the Apache decline were able to offer also a long enough list of well tested advanced features. In fact, a few years after 2000 started, not only other commercial and highly competitive web servers, e.g. LiteSpeed , but also many other open-source programs, often of excellent quality and very high performances, among which should be noted Hiawatha , Cherokee HTTP server , Lighttpd , Nginx and other derived/related products also available with commercial support, emerged. Around 2007–2008, most popular web browsers increased their previous default limit of 2 persistent connections per host-domain (a limit recommended by RFC-2616) to 4, 6 or 8 persistent connections per host-domain, in order to speed up

1755-422: A minor release should occur which may include new features. Every minor release should at least be supported for two years with security and bug fixes, followed by at least one year of only security fixes, for a total of a three-year release process for every minor release. No new features, unless small and self-contained, are to be introduced into a minor release during the three-year release process. The mascot of

1872-722: 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; NULL is the only allowed value for this data type. Web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content ) or its secure variant HTTPS . A user agent, commonly

1989-456: A new static return type, and a new mixed type. "Attributes", often referred to as "annotations" in other programming languages, were added in PHP 8, which allow metadata to be added to classes. throw was changed from being a statement to being an expression. This allows exceptions to be thrown in places that were not previously possible. PHP 8 includes changes to allow alternate, more concise, or more consistent syntaxes in

2106-417: A number of scenarios. For example, the nullsafe operator is similar to the null coalescing operator ?? , but used when calling methods. The following code snippet will not throw an error if getBirthday() returns null: Constructor property promotion has been added as " syntactic sugar ," allowing class properties to be set automatically when parameters are passed into a class constructor . This reduces

2223-514: A physical file system path, to an absolute path under the target website's root directory. Website's root directory may be specified by a configuration file or by some internal rule of the web server by using the name of the website which is the host part of the URL found in HTTP client request. Path translation to file system is done for the following types of web resources: The web server appends

2340-440: A polynomial modulo 2 instead of an integer to map n bits to m bits. In this approach, M = 2 , and we postulate an m th-degree polynomial Z ( x ) = x + ζ m −1 x + ⋯ + ζ 0 . A key K = ( k n −1 … k 1 k 0 ) 2 can be regarded as the polynomial K ( x ) = k n −1 x + ⋯ + k 1 x + k 0 . The remainder using polynomial arithmetic modulo 2

2457-435: A probability of 50% because, if some bits are reluctant to change, then the keys become clustered around those values. If the bits want to change too readily, then the mapping is approaching a fixed XOR function of a single bit. Standard tests for this property have been described in the literature. The relevance of the criterion to a multiplicative hash function is assessed here. In data storage and retrieval applications,

SECTION 20

#1732765188354

2574-457: A programming language [...] I just kept adding the next logical step on the way." A development team began to form and, after months of work and beta testing, officially released PHP/FI 2 in November 1997. The fact that PHP was not originally designed, but instead was developed organically has led to inconsistent naming of functions and inconsistent ordering of their parameters. In some cases,

2691-411: A single input bit is complemented, each of the output bits changes with a 50% probability. The reason for this property is that selected subsets of the keyspace may have low variability. For the output to be uniformly distributed, a low amount of variability, even one bit, should translate into a high amount of variability (i.e. distribution over the tablespace) in the output. Each bit should change with

2808-575: A small and nearly constant time per retrieval. They require an amount of storage space only fractionally greater than the total space required for the data or records themselves. Hashing is a computationally- and storage-space-efficient form of data access that avoids the non-constant access time of ordered and unordered lists and structured trees, and the often-exponential storage requirements of direct access of state spaces of large or variable-length keys. Use of hash functions relies on statistical properties of key and function interaction: worst-case behavior

2925-428: A strong impetus to the adoption of reverse proxies in front of slower web servers and it gave also one more chance to the emerging new web servers that could show all their speed and their capability to handle very high numbers of concurrent connections without requiring too many hardware resources (expensive computers with lots of CPUs, RAM and fast disks). In 2015, RFCs published new protocol version [HTTP/2], and as

3042-415: A variety of operating systems and platforms . The PHP language has evolved without a written formal specification or standard, with the original implementation acting as the de facto standard that other implementations aimed to follow. W3Techs reports that as of 27 October 2024 (about two years since PHP 7 was discontinued and 11 months after the PHP 8.3 release), PHP 7

3159-451: A web server and some of the tasks that it may perform in order to have a sufficiently wide scenario about the topic. A web server program plays the role of a server in a client–server model by implementing one or more versions of HTTP protocol, often including the HTTPS secure variant and other features and extensions that are considered useful for its planned usage. The complexity and

3276-427: A web server implements one or more of the above-mentioned advanced features then the path part of a valid URL may not always match an existing file system path under website directory tree (a file or a directory in file system ) because it can refer to a virtual name of an internal or external module processor for dynamic requests. Web server programs are able to translate an URL path (all or part of it), that refers to

3393-443: Is (barring computational efficiency concerns) generally a good choice as a hash function, but the converse need not be true. Hash tables often contain only a small subset of the valid inputs. For instance, a club membership list may contain only a hundred or so member names, out of the very large set of all possible names. In these cases, the uniformity criterion should hold for almost all typical subsets of entries that may be found in

3510-565: Is a major version and has breaking changes from previous versions. New features and notable changes include: Just-in-time compilation is supported in PHP 8. PHP 8's JIT compiler can provide substantial performance improvements for some use cases, while (then PHP) developer Nikita Popov stated that the performance improvements for most websites will be less substantial than the upgrade from PHP 5 to PHP 7. Substantial improvements are expected more for mathematical-type operations than for common web-development use cases. Additionally,

3627-430: Is added to the table there. If the hash code indexes a full slot, then some kind of collision resolution is required: the new item may be omitted (not added to the table), or replace the old item, or be added to the table in some other location by a specified procedure. That procedure depends on the structure of the hash table. In chained hashing , each slot is the head of a linked list or chain, and items that collide at

PHP - Misplaced Pages Continue

3744-534: Is an example of how PHP variables are declared and initialized. 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. PHP treats newlines as whitespace in the manner of a free-form language , and statements are terminated by a semicolon. PHP has three types of comment syntax : /* */ marks block and inline comments; // or # are used for one-line comments. The echo statement

3861-464: Is especially useful in distributed hash tables . In some applications, the input data may contain features that are irrelevant for comparison purposes. For example, when looking up a personal name, it may be desirable to ignore the distinction between upper and lower case letters. For such data, one must use a hash function that is compatible with the data equivalence criterion being used: that is, any two inputs that are considered equivalent must yield

3978-676: Is intolerably bad but rare, and average-case behavior can be nearly optimal (minimal collision ). Hash functions are related to (and often confused with) checksums , check digits , fingerprints , lossy compression , randomization functions , error-correcting codes , and ciphers . Although the concepts overlap to some extent, each one has its own uses and requirements and is designed and optimized differently. The hash function differs from these concepts mainly in terms of data integrity . Hash tables may use non-cryptographic hash functions , while cryptographic hash functions are used in cybersecurity to secure sensitive data such as passwords. In

4095-413: Is much larger than m —see the birthday problem . In special cases when the keys are known in advance and the key set is static, a hash function can be found that achieves absolute (or collisionless) uniformity. Such a hash function is said to be perfect . There is no algorithmic way of constructing such a function—searching for one is a factorial function of the number of keys to be mapped versus

4212-701: Is no recommendation against the echo short tag <?= . Prior to PHP 5.4.0, this short syntax for echo only works with the short_open_tag configuration setting enabled, while for PHP 5.4.0 and later it is always available. The purpose of all these delimiters is to separate PHP code from non-PHP content, such as JavaScript code or HTML markup. So the shortest "Hello, World!" program written in PHP is: The first form of delimiters, <?php and ?> , in XHTML and other XML documents, creates correctly formed XML processing instructions. This means that

4329-423: Is not processed by PHP, although the 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. The shortened form <? also exists. This short delimiter makes script files less portable since support for them can be disabled in the local PHP configuration and it is therefore discouraged. Conversely, there

4446-507: Is now no longer under development and nor are any security updates planned to be released. On 1 July 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

4563-426: Is often an array with two or more indices (called a grid file , grid index , bucket grid , and similar names), and the hash function returns an index tuple . This principle is widely used in computer graphics , computational geometry , and many other disciplines, to solve many proximity problems in the plane or in three-dimensional space , such as finding closest pairs in a set of points, similar shapes in

4680-415: Is one of several facilities PHP provides to output text. In terms of keywords and language syntax, PHP is similar to 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. PHP is loosely typed . It stores integers in a platform-dependent range, either as a 32, 64 or 128-bit signed integer equivalent to

4797-481: Is referring to, so that that resource can be returned to the requesting client. This process is performed with every request that is made to a web server, with some of the requests being served with a file, such as an HTML document, or a gif image, others with the results of running a CGI program, and others by some other process, such as a built-in module handler, a PHP document, or a Java servlet." In practice, web server programs that implement advanced features, beyond

PHP - Misplaced Pages Continue

4914-658: Is still used by 50.0% of PHP websites, which is outdated and known to be insecure. In addition the even more outdated (discontinued for 5+ years) and insecure PHP 5 is used by 13.2% and the no longer supported PHP 8.0 is also very popular. Meaning the vast majority do not use the supported versions. PHP development began in 1993 when Rasmus Lerdorf wrote several Common Gateway Interface (CGI) programs in C , which he used to maintain his personal homepage . He extended them to work with web forms and to communicate with databases , and called this implementation "Personal Home Page/Forms Interpreter" or PHP/FI. An example of

5031-421: Is stored in 8 bits (as in extended ASCII or ISO Latin 1 ), the table has only 2 = 256 entries; in the case of Unicode characters, the table would have 17 × 2 = 1 114 112 entries. The same technique can be used to map two-letter country codes like "us" or "za" to country names (26 = 676 table entries), 5-digit ZIP codes like 13083 to city names ( 100 000 entries), etc. Invalid data values (such as

5148-405: Is that it will not break up clustered keys. For example, the keys 123000, 456000, 789000, etc. modulo 1000 all map to the same address. This technique works well in practice because many key sets are sufficiently random already, and the probability that a key set will be cyclical by a large prime number is small. Algebraic coding is a variant of the division method of hashing which uses division by

5265-441: Is the number of keys, m is the number of buckets, and b j is the number of items in bucket j . A ratio within one confidence interval (such as 0.95 to 1.05) is indicative that the hash function evaluated has an expected uniform distribution. Hash functions can have some technical properties that make it more likely that they will have a uniform distribution when applied. One is the strict avalanche criterion : whenever

5382-450: Is uniform on the interval [0, 2  − 1] . A hash function uniform on the interval [0, n − 1] is n P (key) / 2 . We can replace the division by a (possibly faster) right bit shift : n P (key) >> b . If keys are being hashed repeatedly, and the hash function is costly, then computing time can be saved by precomputing the hash codes and storing them with the keys. Matching hash codes almost certainly means that

5499-442: The random extension, which provides a pseudorandom number generator with an object-oriented API , Sensitive Parameter value redaction, and a ton of other features. PHP 8.3 was released on November 23, 2023. This release introduced readonly array properties, allowing arrays to be declared as immutable after initialization. It also added support for class aliases for built-in PHP classes, new methods for random float generation in

5616-456: The Bloom filter , a space-efficient probabilistic data structure that is used to test whether an element is a member of a set . A special case of hashing is known as geometric hashing or the grid method . In these applications, the set of all inputs is some sort of metric space , and the hashing function can be interpreted as a partition of that space into a grid of cells . The table

5733-517: The C-language long type . Unsigned integers are converted to signed values in certain situations, which is different behaviour to many 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

5850-601: The CGI to communicate with external programs. These capabilities, along with the multimedia features of NCSA's Mosaic browser (also able to manage HTML FORMs in order to send data to a web server) highlighted the potential of web technology for publishing and distributed computing applications. In the second half of 1994, the development of NCSA httpd stalled to the point that a group of external software developers, webmasters and other professional figures interested in that server, started to write and collect patches thanks to

5967-480: The public domain . This statement freed web server developers from any possible legal issue about the development of derivative work based on that source code (a threat that in practice never existed). At the beginning of 1994, the most notable among new web servers was NCSA httpd which ran on a variety of Unix -based OSs and could serve dynamically generated content by implementing the POST HTTP method and

SECTION 50

#1732765188354

6084-673: The recursive acronym PHP: Hypertext Preprocessor . Afterwards, 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 22 May 2000, PHP 4, powered by the Zend Engine 1.0, was released. By August 2008, this branch had reached version 4.4.9. PHP 4

6201-478: The JIT compiler provides the future potential to move some code from C to PHP, due to the performance improvements for some use cases. PHP 8 introduced the match expression. The match expression is conceptually similar to a switch statement and is more compact for some use cases. Because match is an expression, its result can be assigned to a variable or returned from a function. PHP 8 introduced union types,

6318-629: The NCSA httpd source code being available to the public domain. At the beginning of 1995 those patches were all applied to the last release of NCSA source code and, after several tests, the Apache HTTP server project was started. At the end of 1994, a new commercial web server, named Netsite , was released with specific features. It was the first one of many other similar products that were developed first by Netscape , then also by Sun Microsystems , and finally by Oracle Corporation . In mid-1995,

6435-443: The PHP project is the elePHPant , a blue elephant with the PHP logo on its side, designed by Vincent Pontier in 1998. "The (PHP) letters were forming the shape of an elephant if viewed in a sideways angle." The elePHPant is sometimes differently coloured when in plush toy form. Many variations of this mascot have been made over the years. Only the elePHPants based on the original design by Vincent Pontier are considered official by

6552-513: The PHP source code or by using pre-built binaries. For PHP versions 5.3 and 5.4, the only available Microsoft Windows binary distributions were 32-bit IA-32 builds, requiring Windows 32-bit compatibility mode while using Internet Information Services (IIS) on a 64-bit Windows platform. PHP version 5.5 made the 64-bit x86-64 builds available for Microsoft Windows. Official security support for PHP 5.6 ended on 31 December 2018. PHP received mixed reviews due to lacking native Unicode support at

6669-472: The PHP 6 Unicode experiments had never been released, several articles and book titles referenced the PHP 6 names, which might have caused confusion if a new release were to reuse the name. After a vote, the name PHP 7 was chosen. The foundation of PHP 7 is a PHP branch that was originally dubbed PHP next generation ( phpng ). It was authored by Dmitry Stogov, Xinchen Hui and Nikita Popov, and aimed to optimize PHP performance by refactoring

6786-594: The Random extension, and enhanced PHP INI settings with fallback value support. Additionally, the new stream_context_set_options function provides improved API for stream manipulation, among other updates and deprecations. PHP 8.4 was released on November 21, 2024. Beginning on 28 June 2011, the PHP Development Team implemented a timeline for the release of new versions of PHP. Under this system, at least one release should occur every month. Once per year,

6903-410: The Zend Engine while retaining near-complete language compatibility. By 14 July 2014, WordPress -based benchmarks, which served as the main benchmark suite for the phpng project, showed an almost 100% increase in performance. Changes from phpng make it easier to improve performance in future versions, as more compact data structures and other changes are seen as better suited for a successful migration to

7020-418: The ability to embed HTML . By this point, the syntax had changed to resemble that of Perl , but was simpler, more limited, and less consistent. Early PHP was never intended to be a new programming language ; rather, it grew organically, with Lerdorf noting in retrospect: "I don't know how to stop it [...] there was never any intent to write a programming language [...] I have absolutely no idea how to write

7137-441: The above-mentioned history articles. In March 1989, Sir Tim Berners-Lee proposed a new project to his employer CERN , with the goal of easing the exchange of information between scientists by using a hypertext system. The proposal titled "HyperText and CERN" , asked for comments and it was read by several people. In October 1990 the proposal was reformulated and enriched (having as co-author Robert Cailliau ), and finally, it

SECTION 60

#1732765188354

7254-399: The adoption and the usage of those programs along with their porting to other operating systems . In December 1991, the first web server outside Europe was installed at SLAC (U.S.A.). This was a very important event because it started trans-continental web communications between web browsers and web servers. In 1991–1993, CERN web server program continued to be actively developed by

7371-469: The amount of boilerplate code that must be written. Other minor changes include support for use of ::class on objects, which serves as an alternative for the use of get_class() ; non-capturing catches in try-catch blocks; variable syntax tweaks to resolve inconsistencies; support for named arguments; and support for trailing commas in parameter lists, which adds consistency with support for trailing commas in other contexts, such as in arrays. PHP 8.1

7488-554: The application of web servers well beyond their original purpose of serving human-readable pages. This is a very brief history of web server programs , so some information necessarily overlaps with the histories of the web browsers , the World Wide Web and the Internet ; therefore, for the sake of clarity and understandability, some key historical information below reported may be similar to that found also in one or more of

7605-537: The availability of new protocol , not only because they had the work force and the time to do so, but also because usually their previous implementation of SPDY protocol could be reused as a starting point and because most used web browsers implemented it very quickly for the same reason. Another reason that prompted those developers to act quickly was that webmasters felt the pressure of the ever increasing web traffic and they really wanted to install and to try – as soon as possible – something that could drastically lower

7722-553: The community. These are collectable and some of them are extremely rare. The following "Hello, World!" program is written in PHP code embedded in an HTML document: However, as no requirement exists for PHP code to be embedded in HTML, the simplest version of Hello, World! may be written like this, with the closing tag ?> omitted as preferred in files containing pure PHP code. The PHP interpreter only executes PHP code within its delimiters . Anything outside of its delimiters

7839-476: The core language level. In 2005, a project headed by Andrei Zmievski was initiated to bring native Unicode support throughout PHP, by embedding the International Components for Unicode (ICU) library, and representing text strings as UTF-16 internally. Since this would cause major changes both to the internals of the language and to user code, it was planned to release this as version 6.0 of

7956-448: The cost of hashing-based methods goes up sharply as the number of collisions —pairs of inputs that are mapped to the same hash value—increases. If some hash values are more likely to occur than others, then a larger fraction of the lookup operations will have to search through a larger set of colliding table entries. This criterion only requires the value to be uniformly distributed , not random in any sense. A good randomizing function

8073-452: The country code "xx" or the ZIP code 00000) may be left undefined in the table or mapped to some appropriate "null" value. If the keys are uniformly or sufficiently uniformly distributed over the key space, so that the key values are essentially random, then they may be considered to be already "hashed". In this case, any number of any bits in the key may be extracted and collated as an index into

8190-477: The early PHP syntax : PHP/FI could be used to build simple, dynamic web applications . To accelerate bug reporting and improve the code, Lerdorf initially announced the release of PHP/FI as "Personal Home Page Tools (PHP Tools) version 1.0" on the Usenet discussion group comp.infosystems.www.authoring.cgi on 8 June 1995. This release included basic functionality such as Perl-like variables , form handling, and

8307-870: The efficiency of a web server program may vary a lot depending on (e.g.): Although web server programs differ in how they are implemented, most of them offer the following common features. These are basic features that most web servers usually have. A few other more advanced and popular features ( only a very short selection ) are the following ones. A web server program, when it is running, usually performs several general tasks , (e.g.): Web server programs are able: Once an HTTP request message has been decoded and verified, its values can be used to determine whether that request can be satisfied or not. This requires many other steps, including security checks . Web server programs usually perform some type of URL normalization ( URL found in most HTTP request messages) in order to: The term URL normalization refers to

8424-406: The first version of IIS was released, for Windows NT OS, by Microsoft . This marked the entry, in the field of World Wide Web technologies, of a very important commercial developer and vendor that has played and still is playing a key role on both sides (client and server) of the web. In the second half of 1995, CERN and NCSA web servers started to decline (in global percentage usage) because of

8541-429: The following changes: PHP 7 also included new language features. Most notably, it introduced return type declarations for functions which complement the existing parameter type declarations, and support for the scalar types (integer, float, string, and boolean) in parameter and return type declarations. PHP 8 was released on 26 November 2020, and is currently the second-most used PHP major version. PHP 8

8658-406: The function names were chosen to match the lower-level libraries which PHP was "wrapping", while in some very early versions of PHP the length of the function names was used internally as a hash function , so names were chosen to improve the distribution of hash values . Zeev Suraski and Andi Gutmans rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to

8775-487: The generation of that response. Additionally, PHP can be used for many programming tasks outside the web context, such as standalone graphical applications and drone control. PHP code can also be directly executed from the command line . The standard PHP interpreter, powered by the Zend Engine , is free software released under the PHP License . PHP has been widely ported and can be deployed on most web servers on

8892-408: The hash code is taken as the middle 4 digits of the 17-digit number (ignoring the high digit) 8750. The mid-squares method produces a reasonable hash code if there is not a lot of leading or trailing zeros in the key. This is a variant of multiplicative hashing, but not as good because an arbitrary key is not a good multiplier. A standard technique is to use a modulo function on the key, by selecting

9009-406: The hash function must be chosen so that the result has fairly uniform distribution between 0 and n  − 1 , for any value of n that may occur in the application. Depending on the function, the remainder may be uniform only for certain values of n , e.g. odd or prime numbers . When the hash function is used to store values in a hash table that outlives the run of the program, and

9126-568: The hash table needs to be expanded or shrunk, the hash table is referred to as a dynamic hash table. A hash function that will relocate the minimum number of records when the table is resized is desirable. What is needed is a hash function H ( z , n ) (where z is the key being hashed and n is the number of allowed hash values) such that H ( z , n  + 1) = H ( z , n ) with probability close to n /( n  + 1) . Linear hashing and spiral hashing are examples of dynamic hash functions that execute in constant time but relax

9243-429: The hash table. For example, a simple hash function might mask off the m least significant bits and use the result as an index into a hash table of size 2 . A mid-squares hash code is produced by squaring the input and extracting an appropriate number of middle digits or bits. For example, if the input is 123 456 789 and the hash table size 10 000 , then squaring the key produces 15 241 578 750 190 521 , so

9360-425: The hashed value. The cost of computing this identity hash function is effectively zero. This hash function is perfect , as it maps each input to a distinct hash value. The meaning of "small enough" depends on the size of the type that is used as the hashed value. For example, in Java , the hash code is a 32-bit integer. Thus the 32-bit integer Integer and 32-bit floating-point Float objects can simply use

9477-483: The implementation of new specifications was not trivial at all, a dilemma arose among developers of less popular web servers (e.g. with a percentage of usage lower than 1% .. 2%), about adding or not adding support for that new protocol version. In fact supporting HTTP/2 often required radical changes to their internal implementation due to many factors (practically always required encrypted connections, capability to distinguish between HTTP/1.x and HTTP/2 connections on

9594-439: The input data into chunks of specific size. Hash functions used for data searches use some arithmetic expression that iteratively processes chunks of the input (such as the characters in a string) to produce the hash value. In many applications, the range of hash values may be different for each run of the program or may change along the same run (for instance, when a hash table needs to be expanded). In those situations, one needs

9711-445: The item follows the same procedure until the item is located, an open slot is found, or the entire table has been searched (item not in table). Hash functions are also used to build caches for large data sets stored in slow media. A cache is generally simpler than a hashed search table, since any collision can be resolved by discarding or writing back the older of the two colliding items. Hash functions are an essential ingredient of

9828-538: The item is possible. The determinism is in the context of the reuse of the function. For example, Python adds the feature that hash functions make use of a randomized seed that is generated once when the Python process starts in addition to the input to be hashed. The Python hash ( SipHash ) is still a valid hash function when used within a single run, but if the values are persisted (for example, written to disk), they can no longer be treated as valid hash values, since in

9945-458: The keys are identical. This technique is used for the transposition table in game-playing programs, which stores a 64-bit hashed representation of the board position. A universal hashing scheme is a randomized algorithm that selects a hash function h among a family of such functions, in such a way that the probability of a collision of any two distinct keys is 1/ m , where m is the number of distinct hash values desired—independently of

10062-430: The language, along with other major features then in development. However, a shortage of developers who understood the necessary changes, and performance problems arising from conversion to and from UTF-16, which is rarely used in a web context, led to delays in the project. As a result, a PHP 5.3 release was created in 2009, with many non-Unicode features back-ported from PHP 6, notably namespaces. In March 2010,

10179-405: The low end of the range are embedded systems , such as a router that runs a small web server as its configuration interface. A high-traffic Internet website might handle requests with hundreds of servers that run on racks of high-speed computers. A resource sent from a web server can be a pre-existing file ( static content ) available to the web server, or it can be generated at the time of

10296-429: The mathematical sense of the term. This requirement excludes hash functions that depend on external variable parameters, such as pseudo-random number generators or the time of day. It also excludes functions that depend on the memory address of the object being hashed, because the address may change during execution (as may happen on systems that use certain methods of garbage collection ), although sometimes rehashing of

10413-408: The maximum number of concurrent connections allowed and to improve their level of scalability. Between 1996 and 1999, Netscape Enterprise Server and Microsoft's IIS emerged among the leading commercial options whereas among the freely available and open-source programs Apache HTTP Server held the lead as the preferred server (because of its reliability and its many features). In those years there

10530-487: The multiplicative methods, and the most complex (slowest) are the division-based methods. Because collisions should be infrequent, and cause a marginal delay but are otherwise harmless, it is usually preferable to choose a faster hash function over one that needs more computation but saves a few collisions. Division-based implementations can be of particular concern because a division requires multiple cycles on nearly all processor microarchitectures . Division ( modulo ) by

10647-410: The next run the random value might differ. It is often desirable that the output of a hash function have fixed size (but see below). If, for example, the output is constrained to 32-bit integer values, then the hash values can be used to index into an array. Such hashing is commonly used to accelerate data searches. Producing fixed-length output from variable-length input can be accomplished by breaking

10764-500: The number of TCP/IP connections and speedup accesses to hosted websites. In 2020–2021 the HTTP/2 dynamics about its implementation (by top web servers and popular web browsers) were partly replicated after the publication of advanced drafts of future RFC about HTTP/3 protocol. The following technical overview should be considered only as an attempt to give a few very limited examples about some features that may be implemented in

10881-493: The number of items in the table. Hash functions can be designed to give the best worst-case performance, good performance under high table loading factors, and in special cases, perfect (collisionless) mapping of keys into hash codes. Implementation is based on parity-preserving bit operations (XOR and ADD), multiply, or divide. A necessary adjunct to the hash function is a collision-resolution method that employs an auxiliary data structure like linked lists , or systematic probing of

10998-440: The number of table slots that they are mapped into. Finding a perfect hash function over more than a very small set of keys is usually computationally infeasible; the resulting function is likely to be more computationally complex than a standard hash function and provides only a marginal advantage over a function with good statistical properties that yields a minimum number of collisions. See universal hash function . When testing

11115-567: The only stable version under development. Late static binding had been missing from previous versions of PHP, and was added in version 5.3. Many high-profile open-source projects ceased to support PHP 4 in new code from February 5, 2008, because of the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5. Over time, PHP interpreters became available on most existing 32-bit and 64-bit operating systems, either by building them from

11232-568: The path found in requested URL (HTTP request message) and appends it to the path of the (Host) website root directory. On an Apache server , this is commonly /home/www/website (on Unix machines, usually it is: /var/www/website ). See the following examples of how it may result. URL path translation for a static file request Hash values A hash function is any function that can be used to map data of arbitrary size to fixed-size values, though there are some hash functions that support variable-length output. The values returned by

11349-431: The process of modifying and standardizing a URL in a consistent manner. There are several types of normalization that may be performed, including the conversion of the scheme and host to lowercase. Among the most important normalizations are the removal of "." and ".." path segments and adding trailing slashes to a non-empty path component. "URL mapping is the process by which a URL is analyzed to figure out what resource it

11466-470: The project in its current form was officially abandoned, and a PHP 5.4 release was prepared to contain most remaining non-Unicode features from PHP 6, such as traits and closure re-binding. Initial hopes were that a new plan would be formed for Unicode integration, but by 2014 none had been adopted. During 2014 and 2015, a new major PHP version was developed, PHP 7. The numbering of this version involved some debate among internal developers. While

11583-458: The property of uniformity to achieve the minimal movement property. Extendible hashing uses a dynamic hash function that requires space proportional to n to compute the hash function, and it becomes a function of the previous keys that have been inserted. Several algorithms that preserve the uniformity property but require time proportional to n to compute the value of H ( z , n ) have been invented. A hash function with minimal movement

11700-424: The request ( dynamic content ) by another program that communicates with the server software. The former usually can be served faster and can be more easily cached for repeated requests, while the latter supports a broader range of applications. Technologies such as REST and SOAP , which use HTTP as a basis for general computer-to-computer communication, as well as support for WebDAV extensions, have extended

11817-496: The resulting mixture of PHP code and other markups 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. PHP 5 introduced type declarations that allow functions to force their parameters to be objects of a specific class, arrays, interfaces or callback functions . However, before PHP 7, type declarations could not be used with scalar types such as integers or strings. Below

11934-429: The retrieval of heavy web pages with lots of images, and to mitigate the problem of the shortage of persistent connections dedicated to dynamic objects used for bi-directional notifications of events in web pages. Within a year, these changes, on average, nearly tripled the maximum number of persistent connections that web servers had to manage. This trend (of increasing the number of persistent connections) definitely gave

12051-416: The same TCP port, binary representation of HTTP messages, message priority, compression of HTTP headers, use of streams also known as TCP/IP sub-connections and related flow-control, etc.) and so a few developers of those web servers opted for not supporting new HTTP/2 version (at least in the near future) also because of these main reasons: Instead, developers of most popular web servers, rushed to offer

12168-439: The same hash value. This can be accomplished by normalizing the input before hashing it, as by upper-casing all letters. There are several common algorithms for hashing integers. The method giving the best distribution is data-dependent. One of the simplest and most common methods in practice is the modulo division method. If the data to be hashed is small enough, then one can use the data itself (reinterpreted as an integer) as

12285-426: The simple static content serving (e.g. URL rewrite engine, dynamic content serving), usually have to figure out how that URL has to be handled, e.g. as a: One or more configuration files of web server may specify the mapping of parts of URL path (e.g. initial parts of file path , filename extension and other path components) to a specific URL handler (file, directory, external program or internal module). When

12402-431: The slot are added to the chain. Chains may be kept in random order and searched linearly, or in serial order, or as a self-ordering list by frequency to speed up access. In open address hashing , the table is probed starting from the occupied slot in a specified manner, usually by linear probing , quadratic probing , or double hashing until an open slot is located or the entire table is probed (overflow). Searching for

12519-400: The table to find an empty slot. Hash functions are used in conjunction with hash tables to store and retrieve data items or data records. The hash function translates the key associated with each datum or record into a hash code, which is used to index the hash table. When an item is to be added to the table, the hash code may index an empty slot (also called a bucket), in which case the item

12636-417: The table, not just for the global set of all possible entries. In other words, if a typical set of m records is hashed to n table slots, then the probability of a bucket receiving many more than m / n records should be vanishingly small. In particular, if m < n , then very few buckets should have more than one or two records. A small number of collisions is virtually inevitable, even if n

12753-407: The two keys. Universal hashing ensures (in a probabilistic sense) that the hash function application will behave as well as if it were using a random function, for any distribution of the input data. It will, however, have more collisions than perfect hashing and may require more operations than a special-purpose hash function. A hash function that allows only certain table sizes or strings only up to

12870-420: The use of a hash function is a trade-off between search time and data storage space. If search time were unbounded, then a very compact unordered linear list would be the best medium; if storage space were unbounded, then a randomly accessible structure indexable by the key-value would be very large and very sparse, but very fast. A hash function takes a finite amount of time to map a potentially large keyspace to

12987-432: The value directly, whereas the 64-bit integer Long and 64-bit floating-point Double cannot. Other types of data can also use this hashing scheme. For example, when mapping character strings between upper and lower case , one can use the binary encoding of each character, interpreted as an integer, to index a table that gives the alternative form of that character ("A" for "a", "8" for "8", etc.). If each character

13104-720: The widespread adoption of new web servers which had a much faster development cycle along with more features, more fixes applied, and more performances than the previous ones. At the end of 1996, there were already over fifty known (different) web server software programs that were available to everybody who wanted to own an Internet domain name and/or to host websites. Many of them lived only shortly and were replaced by other web servers. The publication of RFCs about protocol versions HTTP/1.0 (1996) and HTTP/1.1 (1997, 1999), forced most web servers to comply (not always completely) with those standards. The use of TCP/IP persistent connections (HTTP/1.1) required web servers both to increase

13221-418: The www group, meanwhile, thanks to the availability of its source code and the public specifications of the HTTP protocol, many other implementations of web servers started to be developed. In April 1993, CERN issued a public official statement stating that the three components of Web software (the basic line-mode client, the web server and the library of common code), along with their source code , were put in

13338-817: Was also another commercial, highly innovative and thus notable web server called Zeus ( now discontinued ) that was known as one of the fastest and most scalable web servers available on market, at least till the first decade of 2000s, despite its low percentage of usage. Apache resulted in the most used web server from mid-1996 to the end of 2015 when, after a few years of decline, it was surpassed initially by IIS and then by Nginx. Afterward IIS dropped to much lower percentages of usage than Apache (see also market share ). From 2005–2006, Apache started to improve its speed and its scalability level by introducing new performance features (e.g. event MPM and new content cache). As those new performance improvements initially were marked as experimental, they were not enabled by its users for

13455-461: Was approved. Between late 1990 and early 1991 the project resulted in Berners-Lee and his developers writing and testing several software libraries along with three programs, which initially ran on NeXTSTEP OS installed on NeXT workstations: Those early browsers retrieved web pages written in a simple early form of HTML , from web server(s) using a new basic communication protocol that

13572-472: Was named HTTP 0.9 . In August 1991 Tim Berners-Lee announced the birth of WWW technology and encouraged scientists to adopt and develop it. Soon after, those programs, along with their source code , were made available to people interested in their usage. Although the source code was not formally licensed or placed in the public domain, CERN informally allowed users and developers to experiment and further develop on top of them. Berners-Lee started promoting

13689-499: Was released on November 25, 2021. It added support for enumerations (also called "enums"), declaring properties as readonly (which prevents modification of the property after initialization), and array unpacking with string keys. The new never type can be used to indicate that a function does not return. PHP 8.2 was released on December 8, 2022. New in this release are readonly classes (whose instance properties are implicitly readonly), disjunctive normal form (DNF) types, and

#353646