PHP: Difference between revisions

Content deleted Content added
mNo edit summary
 
(19 intermediate revisions by 13 users not shown)
Line 8:
| designer = [[Rasmus Lerdorf]]
| developer = {{URL|https://php.net/credits/|The PHP Development Team}}, [[Zend Technologies]], {{URL|https://thephp.foundation/|PHP Foundation}}
| latest release version = 8.34.131
| latest release date = {{Start date and age|2024|1011|2421|df=y}}<ref>{{Cite web|url=https://www.php.net/archive/2024.php#2024-10-24-1|title=PHP: NewsPHP Archive8.4.0 Release 2024Announcement|website=www.php.net|url=https://www.php.net/releases/8.4/index.php }}</ref>
| latest preview version = 8.4.0 RC 3
| latest preview date = {{Start date and age|2024|10|24|df=y}}<ref>{{Cite web|url=https://www.php.net/archive/2024.php#2024-10-24-3|title=PHP: News Archive – 2024|website=www.php.net}}</ref>
| typing = [[Dynamic typing|Dynamic]], [[strong and weak typing|weak]], [[gradual typing|gradual]]<ref>{{cite web|url=https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.strict|title=PHP: Function arguments – Manual|website=secure.php.net}}</ref>
| implementations = [[Zend Engine]], [[HHVM]], [[PeachPie]], [[Quercus (software)|Quercus]], [[Parrot virtual machine|Parrot]]
Line 30 ⟶ 28:
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 a variety of [[operating system]]s and [[computing platform|platforms]].<ref name="O'Reilly-2001" />
 
The PHP language has evolved without a written [[formal specification]] or standard<!-- until 2014 -->, with the original [[implementation]] acting as the ''[[de facto]]'' standard that other implementations aimed to follow. <!-- PHP standard spec dropped at GitHub, besides would have been on old EOLed version of PHP: Since 2014, work has gone on to create a formal PHP specification.<ref>{{cite web|last1=Jackson|first1=Joab|title=PHP gets a formal specification, at last|url=https://www.computerworld.com/article/2490649/php-gets-a-formal-specification--at-last.html|website=Computerworld|publisher=[[International Data Group|IDG]]|date=2014-07-31}}</ref> -->
 
W3Techs reports that {{as of|2024|10|27|lc=y}} (about two years since <!-- 28 November 2022 --> PHP&nbsp;7 was discontinued and 11 months after the PHP&nbsp;8.3 release), PHP&nbsp;7 is still used by 50.0% of PHP websites, which is outdated and known to be insecure.<ref name="www.php.net">{{Cite web|url=https://www.php.net/eol.php|title=PHP: Unsupported Branches|website=www.php.net}}</ref><ref name="W3Techs – World Wide Web Technology Surveys" /> In addition the even more outdated (discontinued for 5+ <!-- since 31 December 2018 --> years) and insecure PHP&nbsp;5 is used by 13.2% and the no longer supported PHP&nbsp;8.0 is also very popular. Meaning <!-- "Version 8 is used by 27.8% of all the websites. .. Version 8.1 is used by 40.2% of all the websites who use PHP version 8." i.e. 8.1 used by 0.278 * 0.402 = 11% of the websites --> the vast majority do not use the supported versions.
 
== History ==
Line 191 ⟶ 189:
=== PHP 8.2 ===
PHP 8.2 was released on December 8, 2022.<ref>{{Cite web|url=https://www.php.net/ChangeLog-8.php#8.2.0 |title=PHP 8 ChangeLog |access-date=2024-01-05 |website=PHP.net}}</ref> New in this release are <code>readonly</code> classes (whose instance properties are implicitly readonly), [[disjunctive normal form]] (DNF) types, and the <code>random</code> extension, which provides a [[pseudorandom number generator]] with an object-oriented [[API]],<ref>{{Cite web|title=PHP: PHP 8.2.0 Release Announcement |url=https://www.php.net/releases/8.2/en.php |access-date=2024-01-05 |website=PHP.net}}</ref> Sensitive Parameter value redaction, and a ton of other features.
 
=== PHP 8.3 ===
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 the Random extension, and enhanced PHP INI settings with fallback value support. Additionally, the new {{Mono|stream_context_set_options}} function provides improved API for stream manipulation, among other updates and deprecations​.
 
=== PHP 8.4 ===
PHP 8.4 was released on November 21, 2024.
 
=== Release history ===
Line 323 ⟶ 327:
| Readonly classes,<ref>{{Cite web |title=PHP: rfc:readonly_classes |url=https://wiki.php.net/rfc/readonly_classes |access-date=2022-06-16 |website=wiki.php.net}}</ref> {{code|lang=php|code=null}}, {{code|lang=php|code=false}}, and {{code|lang=php|code=true}} as stand-alone types,<ref>{{Cite web |title=PHP: rfc:null-false-standalone-types |url=https://wiki.php.net/rfc/null-false-standalone-types |access-date=2022-06-16 |website=wiki.php.net}}</ref><ref>{{Cite web |title=PHP: rfc:true-type |url=https://wiki.php.net/rfc/true-type |access-date=2022-06-16 |website=wiki.php.net}}</ref> locale-independent case conversion,<ref>{{Cite web |title=PHP: rfc:strtolower-ascii |url=https://wiki.php.net/rfc/strtolower-ascii |access-date=2022-06-16 |website=wiki.php.net}}</ref> disjunctive normal form types,<ref>{{Cite web |title=PHP: rfc:dnf_types |url=https://wiki.php.net/rfc/dnf_types |access-date=2023-02-07 |website=wiki.php.net}}</ref> constants in traits<ref>{{Cite web |title=PHP: rfc:constants_in_traits |url=https://wiki.php.net/rfc/constants_in_traits |access-date=2023-02-07 |website=wiki.php.net}}</ref>
|-
| {{Version |cco | 8.3}}
| 23 November 2023<ref>{{Cite web |date=23 November 2023 |title=PHP 8.3.0 Released! |url=https://www.php.net/archive/2023.php#2023-11-23-2 |access-date=24 November 2023 |website=php.net}}</ref>
| 31 December 2027
| Typed class constants,<ref>{{Cite web |title=PHP: rfc:typed_class_constants |url=https://wiki.php.net/rfc/typed_class_constants |access-date=2023-12-17 |website=wiki.php.net}}</ref> dynamic class constant fetch,<ref>{{Cite web |title=PHP: rfc:dynamic_class_constant_fetch |url=https://wiki.php.net/rfc/dynamic_class_constant_fetch |access-date=2023-12-17 |website=wiki.php.net}}</ref> {{code|lang=php|code=#[\Override]}} attribute,<ref>{{Cite web |title=PHP: rfc:marking_overriden_methods |url=https://wiki.php.net/rfc/marking_overriden_methods |access-date=2023-12-17 |website=wiki.php.net}}</ref> deep-cloning of read-only properties,<ref>{{Cite web |title=PHP: rfc:readonly_amendments |url=https://wiki.php.net/rfc/readonly_amendments |access-date=2023-12-17 |website=wiki.php.net}}</ref> new {{code|lang=php|code=json_validate}} function,<ref>{{Cite web |title=PHP: rfc:json_validate |url=https://wiki.php.net/rfc/json_validate |access-date=2023-12-17 |website=wiki.php.net}}</ref> randomizer additions,<ref>{{Cite web |title=PHP: rfc:randomizer_additions |url=https://wiki.php.net/rfc/randomizer_additions |access-date=2023-12-17 |website=wiki.php.net}}</ref> the command-line linter supports multiple files
|-
| {{Version |pc | 8.4}}
| 21 November 2024<ref>{{Cite web |date=26 March 2024 |title=PHP: todo: php84|url=https://wiki.php.net/todo/php84 |access-date=26 March 2024 |website=php.net}}</ref>
| 31 December 2028
|
|-
| {{Version |p | 8.5}}
| November 2025
| 31 December 2029
|
|- class="sortbottom"
Line 710 ⟶ 719:
| url = https://github.com/cztomczak/phpdesktop
| title = PHP Desktop
| website = [[GitHub]]
}} or discontinued [[PHP-GTK]] extension. PHP-GTK is not included in the official PHP distribution,<ref name="php.net-4" /> and as an extension, it can be used only with PHP versions 5.1.0 and newer. The most common way of installing PHP-GTK is by compiling it from the source code.<ref>{{cite web
| url = http://gtk.php.net/manual/en/tutorials.installation.php
Line 859 ⟶ 869:
{{As of|2013|1}}, PHP was used in more than 240&nbsp;million [[website]]s (39% of those sampled) and was installed on 2.1&nbsp;million [[web server]]s.<ref>{{cite web | url=http://news.netcraft.com/archives/2013/01/31/php-just-grows-grows.html | title=PHP just grows & grows | date=2013-01-31 | access-date=2013-04-01 | author=Ide, Andy}}</ref>
 
{{As of|2024|1011|2721}} (11the monthsday afterof PHP&nbsp;8.34's release), PHP is used as the server-side programming language on 75.84% of websites where the language could be determined; PHP&nbsp;7 is the most used version of the language with 5149.1% of websites using PHP being on that version, while 3537.39% use PHP&nbsp;8, 1312.59% use PHP 5 and 0.1% use PHP 4.<ref name="W3Techs – World Wide Web Technology Surveys">{{cite web |title=Usage statistics of PHP for websites |url=https://w3techs.com/technologies/details/pl-php |website=W3Techs – World Wide Web Technology Surveys |publisher=W3Techs |access-date=2721 OctoberNovember 2024}}</ref>
 
{{Stacked bar
|A1=35.3|T1=PHP&nbsp;8<br />3537.39%|C1=linear-gradient(to right, #66FF66 0.1%, #D4F4B4 229.64%, #FEF8C6 4236.6%, #FFCC66, #FF7800); <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
|A2=5149.01|T2=PHP&nbsp;7<br />5149.1%|C2=linear-gradient(to right, #dc2626 71.7%, #ef4444, #f87171, #fca5a5, #fecaca);
|A3=13.5|T3=PHP&nbsp;5<br />1312.59%|C3=linear-gradient(to right, #075985 54.2%, #0369a1, #0284c7, #0ea5e9, #38bdf8, #7dd3fc, #bae6fd);
|A4=0.1|T4=PHP&nbsp;4<br />0.1%|C4=#d4d4d4;
}}
Line 870 ⟶ 880:
{{Pie chart
|radius = 160
<!-- PHP version 8 (3537.39%) -->
|value1 = 2.720 <!-- Formula: Version 8.34 is used by 70.70% of all the websites who use PHP version 8, so 3537.39 / 100 * 70.70 = 2.720 -->
|label1 = PHP 8.34: 7less than 0.701% of PHP 8
|color1 = #66FF66 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
 
|value5value2 = 363.5756 <!-- Formula: Version 78.43 is used by 719.74% of all the websites who use PHP version 78, so 5137.9 / 100 * 719.74 = 363.5756 -->
|value2 = 7.98
|label2 = PHP 8.23: 229.640% of PHP 8
|color2 = #D4F4B4 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
 
|value3 = 10.08
|value3 = 14.83 <!-- seemst to be actually 11%, thus outdated numbers here? -->
|label3 = PHP 8.12: 4226.06% of PHP 8
|color3 = #FEF8C6 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
 
|value3value4 = 14.8363 <!-- seemst to be actually 11%, thus outdated numbers here? -->
|value4 = 9.78
|label4 = PHP 8.01: 2738.76% of PHP 8
|color4 = #FFCC66 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
 
|value4value5 = 9.7863
<!-- PHP version 7 (51%) -->
|label5 = PHP 78.40: 7125.74% of PHP 78
|value5 = 36.57 <!-- Formula: Version 7.4 is used by 71.7% of all the websites who use PHP version 7, so 51 / 100 * 71.7 = 36.57 -->
|color5 = #FF7800 <!-- Please keep this color scheme for PHP 8: it reflects the actual and security of each branch -->
|label5 = PHP 7.4: 71.7% of PHP 7
 
|color5 = #dc2626
<!-- PHP version 7 (5149.1%) -->
|value6 = 35.50 <!-- Formula: Version 7.4 is used by 72.3% of all the websites who use PHP version 7, so 49.1 / 100 * 72.3 = 35.50 -->
|label6 = PHP 7.4: 72.3% of PHP 7
|color5color6 = #dc2626
 
|value6value7 = 65.0770
|label6label7 = PHP 7.3: 11.96% of PHP 7
|color6color7 = #ef4444
 
|value7value8 = 4.4922
|label7label8 = PHP 7.2: 8.8060% of PHP 7
|color7color8 = #f87171
 
|value8value9 = 1.9482
|label8label9 = PHP 7.1: 3.8070% of PHP 7
|color8color9 = #fca5a5
 
|value9value10 = 1.9987
|label9label10 = PHP 7.0: 3.9080% of PHP 7
|color9color10 = #fecaca
 
<!-- PHP version 5 (1312.59%) -->
|value10value11 = 7.31700176
|label10label11 = PHP 5.6: 54.24% of PHP 5
|color10color11 = #075985
 
|value11value12 = 1.10700578
|label11label12 = PHP 5.5: 8.20% of PHP 5
|color11color12 = #0369a1
 
|value12value13 = 21.09259737
|label12label13 = PHP 5.4: 15.53% of PHP 5
|color12color13 = #0284c7
 
|value13value14 = 1.98458963
|label13label14 = PHP 5.3: 14.7% of PHP 5
|color13color14 = #0ea5e9
 
|value14value15 = 0.91808772
|label14label15 = PHP 5.2: 6.80% of PHP 5
|color14color15 = #38bdf8
 
|value15value16 = 0.05400516
|label15label16 = PHP 5.1: 0.40% of PHP 5
|color15color16 = #7dd3fc
 
|value16value17 = 0.0135
|label16label17 = PHP 5.0: less than 0.101% of PHP 5
|color16color17 = #bae6fd
 
<!-- PHP version 4 (0.1%) -->
|value17value18 = 0.07640759
|label17label18 = PHP 4.4: 7675.49% of PHP 4
|color17color18 = #525252
 
|value18value19 = 0.01900192
|label18label19 = PHP 4.3: 19.02% of PHP 4
|color18color19 = #737373
 
|value19value20 = 0.00330037
|label19label20 = PHP 4.2: 3.3070% of PHP 4
|color19color20 = #a3a3a3
 
|value20value21 = 0.0009
|label20label21 = PHP 4.1: 0.90% of PHP 4
|color20color21 = #d4d4d4
 
|value21value22 = 0.0004
|label21label22 = PHP 4.0: 0.40% of PHP 4
|color21color22 = #e5e5e5
|caption = Usage share of PHP versions on 2321 SeptemberNovember 2024:<br /> tenthe monthsday afterof PHP 8.34's release<ref name="W3Techs – World Wide Web Technology Surveys" /><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/4|title=Usage Statistics and Market Share of PHP Version 4 for Websites, SeptemberNovember 2024|website=w3techs.com}}</ref><ref name="w3techs.com">{{Cite web|url=https://w3techs.com/technologies/details/pl-php/5|title=Usage Statistics and Market Share of PHP Version 5 for Websites, SeptemberNovember 2024|website=w3techs.com}}</ref><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/7|title=Usage Statistics and Market Share of PHP Version 7 for Websites, SeptemberNovember 2024|website=w3techs.com}}</ref><ref>{{Cite web|url=https://w3techs.com/technologies/details/pl-php/8|title=Usage Statistics and Market Share of PHP Version 8 for Websites, SeptemberNovember 2024|website=w3techs.com}}</ref>
}}
 
Line 1,112 ⟶ 1,126:
[[Category:Dynamically typed programming languages]]
[[Category:Filename extensions]]
[[Category:Free compilers and open source interpreters]]
[[Category:High-level programming languages]]
[[Category:Internet terminology]]