Commit: 7039836fcaed4f4b0a836ee8bb0e8531508b2288
Author: Alexander Makarov <[email protected]> Tue, 17 Nov 2020
22:37:53 +0300
Committer: Sara Golemon <[email protected]> Wed, 25 Nov 2020 20:28:13 +0000
Parents: 2b6ff1a463e28a7eabd6fcdd8c17b6368fdda146
Branches: master
Link:
http://git.php.net/?p=web/php.git;a=commitdiff;h=7039836fcaed4f4b0a836ee8bb0e8531508b2288
Log:
Add Russian version and language switch
Changed paths:
M releases/8_0_x.php
A releases/8_0_x_ru.php
diff --git a/releases/8_0_x.php b/releases/8_0_x.php
index efe41fe54..0e928731f 100644
--- a/releases/8_0_x.php
+++ b/releases/8_0_x.php
@@ -2,6 +2,10 @@
$_SERVER['BASE_PAGE'] = 'releases/8_0_x.php';
include_once __DIR__ . '/../include/prepend.inc';
+if ($LANG !== 'en' && file_exists('8_0_x_' . $LANG . '.php')) {
+ header("Location: /releases/8_0_x_" . $LANG . '.php');
+}
+
site_header("PHP 8.0.0 Release Announcement", array(
"current" => "php_8_0_x",
'css' => array('php8.css'),
diff --git a/releases/8_0_x_ru.php b/releases/8_0_x_ru.php
new file mode 100644
index 000000000..bb1614834
--- /dev/null
+++ b/releases/8_0_x_ru.php
@@ -0,0 +1,465 @@
+<?php
+$_SERVER['BASE_PAGE'] = 'releases/8_0_x.php';
+include_once __DIR__ . '/../include/prepend.inc';
+
+if ($LANG !== 'ru' && file_exists('8_0_x_' . $LANG . '.php')) {
+ header("Location: /releases/8_0_x_" . $LANG . '.php');
+}
+
+site_header("PHP 8.0.0, релиз", array(
+ "current" => "php_8_0_x",
+ 'css' => array('php8.css'),
+ 'meta_tags' => array(
+ 'og:image' => $MYSITE . 'images/php8/php_8_released.png'
+ )
+));
+?>
+<section class="php8-section php8-section_dark php8-section_header center">
+ <div class="php8-section__content">
+ <div class="php8-logo">
+ <img src="/images/php8/logo_php8.svg" alt="php8" height="126"
width="343">
+ </div>
+ <div class="php8-title">релизнут!</div>
+ <div class="php8-subtitle">
+ PHP 8.0 — большое обновление PHP.<br class="display-none-md"> Оно
содержит множество новых возможностей и
+ оптимизаций, включая именованные аргументы, union type, атрибуты,
constructor property promotion, выражение match,
+ nullsafe оператор, JIT и улучшения в системе типов, обработке ошибок и
консистентности.
+ </div>
+ <div class="php8-button-wrapper center">
+ <a class="php8-button php8-button_light" href="#">Переходите на PHP
8!</a>
+ </div>
+ </div>
+</section>
+
+<section class="php8-section center">
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="named-arguments">
+ Именованные аргументы
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/named_params">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+ <pre>htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, 'UTF-8',
false);</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+ <pre>htmlspecialchars($string, double_encode: false);</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <ul>
+ <li>Указывайте только необходимые параметры, пропускайте
опциональные.</li>
+ <li>Порядок аргументов не важен, аргументы самодокументируемы.</li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="attributes">
+ Атрибуты
+ <a class="php8-rfc" href="https://wiki.php.net/rfc/attributes_v2">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>/**
+* @Route("/api/posts/{id}", methods={"GET", "HEAD"})
+*/
+classUser
+{</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+<pre>#[Route("/api/posts/{id}", methods: ["GET", "HEAD"])]
+class User
+{</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>Вместо аннотаций PHPDoc вы можете использовать структурные метаданные
в с нативным PHP синтаксисом.</p>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="constructor-property-promotion">
+ Constructor property promotion
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/constructor_promotion">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>class Point {
+ public float $x;
+ public float $y;
+ public float $z;
+
+ public function __construct(
+ float $x = 0.0,
+ float $y = 0.0,
+ float $z = 0.0,
+ ) {
+ $this->x = $x;
+ $this->y = $y;
+ $this->z = $z;
+ }
+}</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+<pre>class Point {
+ public function __construct(
+ public float $x = 0.0,
+ public float $y = 0.0,
+ public float $z = 0.0,
+ ) {}
+}</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>Less boilerplate code for defining and initializing properties.</p>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="union-types">
+ Union types
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/union_types_v2">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>class Number {
+ /** @var int|float */
+ private $number;
+
+ /**
+ * @param float|int $number
+ */
+ public function __construct($number) {
+ $this->number = $number;
+ }
+}
+
+new Number('NaN'); // Ok</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+<pre>class Number {
+ public function __construct(
+ private int|float $number
+ ) {}
+}
+
+new Number('NaN'); // TypeError</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>Instead of PHPDoc annotations for a combination of types, you can use
native union type declarations that are
+ validated at runtime.</p>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="match-expression">
+ Match expression
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/match_expression_v2">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>switch (8.0) {
+ case '8.0':
+ $result = "Oh no!";
+ break;
+ case 8.0:
+ $result = "This is what I expected";
+ break;
+}
+echo $result;
+//> Oh no!</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+<pre>echo match (8.0) {
+ '8.0' => "Oh no!",
+ 8.0 => "This is what I expected",
+};
+//> This is what I expected</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>The new match is similar to switch and has the following features:</p>
+ <ul>
+ <li>Match is an expression, meaning its result can be stored in a
variable or returned.</li>
+ <li>Match branches only support single-line expressions and do not
need a break; statement.</li>
+ <li>Match does strict comparisons.</li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="nullsafe-operator">
+ Nullsafe operator
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/nullsafe_operator">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>$country = null;
+
+if ($session !== null) {
+ $user = $session->user;
+
+ if ($user !== null) {
+ $address = $user->getAddress();
+
+ if ($address !== null) {
+ $country = $address->country;
+ }
+ }
+}</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+ <pre>$country = $session?->user?->getAddress()?->country;</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>Instead of null check conditions, you can now use a chain of calls
with the new nullsafe operator. When the
+ evaluation of one element in the chain fails, the execution of the
entire chain is aborted and the entire chain
+ evaluates to null.</p>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="saner-string-to-number-comparisons">
+ Saner string to number comparisons
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/string_to_number_comparison">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+ <pre>0 == 'foobar' // true</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+ <pre>0 == 'foobar' // false</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>When comparing to a numeric string, PHP 8 uses a number comparison.
Otherwise, it converts the number to a
+ string and uses a string comparison.</p>
+ </div>
+ </div>
+
+ <div class="php8-compare">
+ <h2 class="php8-h2" id="consistent-type-errors-for-internal-functions">
+ Consistent type errors for internal functions
+ <a class="php8-rfc"
href="https://wiki.php.net/rfc/consistent_type_errors">RFC</a>
+ </h2>
+ <div class="php8-compare__main">
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label">PHP 7</div>
+ <div class="php8-code phpcode">
+<pre>strlen([]); // Warning: strlen() expects parameter 1 to be string, array
given
+
+array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be
greater than 0</pre>
+ </div>
+ </div>
+ <div class="php8-compare__arrow"></div>
+ <div class="php8-compare__block example-contents">
+ <div class="php8-compare__label php8-compare__label_new">PHP 8</div>
+ <div class="php8-code phpcode">
+<pre>strlen([]); // TypeError: strlen(): Argument #1 ($str) must be of type
string, array given
+
+array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must
be greater than 0</pre>
+ </div>
+ </div>
+ </div>
+ <div class="php8-compare__content">
+ <p>Most of the internal functions now throw a Fatal Error exception if
parameter validation fails.</p>
+ </div>
+ </div>
+</section>
+
+<section class="php8-section php8-section_light">
+ <h2 class="php8-h2">Just-In-Time compilation</h2>
+ <p>
+ PHP 8 introduces two JIT compilation engines. Tracing JIT, the most
promising of the two, shows about 3 times better
+ performance on synthetic benchmarks and 1.5–2 times improvement on some
specific long-running applications. Typical
+ application performance is on par with PHP 7.4.
+ </p>
+ <p>
+ <img src="/images/php8/jit.png" alt="Just-In-Time compilation">
+ </p>
+
+ <h2 class="php8-h2 php8-h2_margin-top">Other syntax tweaks and
improvements</h2>
+ <div class="php8-columns">
+ <div class="php8-column">
+ <ul>
+ <li>
+ Allow trailing comma in parameter list <a
href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a>
+ and closure use lists <a
href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>.
+ </li>
+ <li>
+ Non-capturing catches <a href="http://TODO">RFC</a>.
+ </li>
+ <li>
+ Variable Syntax Tweaks <a
href="https://wiki.php.net/rfc/variable_syntax_tweaks">RFC</a>.
+ </li>
+ </ul>
+ </div>
+ <div class="php8-column">
+ <ul>
+ <li>
+ Treat namespaced names as single token <a
href="https://wiki.php.net/rfc/namespaced_names_as_token">RFC</a>.
+ </li>
+ <li>
+ Throw expression <a
href="https://wiki.php.net/rfc/throw_expression">RFC</a>.
+ </li>
+ <li>
+ Allow ::class on objects <a
href="https://wiki.php.net/rfc/class_name_literal_on_object">RFC</a>.
+ </li>
+ </ul>
+ </div>
+ </div>
+ <div class="php8-columns">
+ <div class="php8-column">
+ <h2 class="php8-h2 php8-h2_margin-top">Type system and error handling
improvements</h2>
+ <ul>
+ <li>
+ Saner string to number comparisons <a
href="https://wiki.php.net/rfc/string_to_number_comparison">RFC</a>.
+ </li>
+ <li>
+ Stricter type checks for arithmetic/bitwise operators
+ <a
href="https://wiki.php.net/rfc/arithmetic_operator_type_checks">RFC</a>.
+ </li>
+ <li>
+ Abstract trait method validation <a href="http://TODO">RFC</a>.
+ </li>
+ <li>
+ Correct signatures of magic methods <a
href="https://wiki.php.net/rfc/magic-methods-signature">RFC</a>
+ </li>
+ <li>
+ Reclassified engine warnings <a
href="https://wiki.php.net/rfc/engine_warnings">RFC</a>.
+ </li>
+ <li>
+ Fatal error for incompatible method signatures <a
href="https://wiki.php.net/rfc/lsp_errors">RFC</a>.
+ </li>
+ <li>
+ The @ operator no longer silences fatal errors.
+ </li>
+ <li>
+ Inheritance with private methods <a
href="https://wiki.php.net/rfc/inheritance_private_methods">RFC</a>.
+ </li>
+ <li>
+ Mixed type <a href="https://wiki.php.net/rfc/mixed_type_v2">RFC</a>.
+ </li>
+ <li>
+ Static return type <a href="">RFC</a>.
+ </li>
+ <li>
+ Types for internal functions
+ <a href="https://externals.io/message/106522">RFC</a>.
+ </li>
+ <li>
+ Curl objects instead of resources
+ <a href="https://php.watch/versions/8.0/resource-CurlHandle">RFC</a>.
+ </li>
+ </ul>
+ </div>
+ <div class="php8-column">
+ <h2 class="php8-h2 php8-h2_margin-top">New Classes, Interfaces, and
Functions</h2>
+ <ul>
+ <li>
+ <a href="https://wiki.php.net/rfc/weak_maps">Weak Map</a> class
+ </li>
+ <li>
+ <a href="https://wiki.php.net/rfc/stringable">Stringable</a>
interface
+ </li>
+ <li>
+ <a href="https://wiki.php.net/rfc/str_contains">str_contains()</a>,
+ <a
href="https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions">str_starts_with()</a>,
+ <a
href="https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions">str_ends_with()</a>
+ </li>
+ <li>
+ <a href="https://github.com/php/php-src/pull/4769">fdiv()</a>
+ </li>
+ <li>
+ <a
href="https://wiki.php.net/rfc/get_debug_type">get_debug_type()</a>
+ </li>
+ <li>
+ <a
href="https://github.com/php/php-src/pull/5427">get_resource_id()</a>
+ </li>
+ <li>
+ <a
href="https://wiki.php.net/rfc/token_as_object">token_get_all()</a> object
implementation
+ </li>
+ </ul>
+ </div>
+ </div>
+</section>
+
+<section class="php8-section php8-section_dark php8-section_footer
php8-footer">
+ <div class="php8-section__content">
+ <h2 class="php8-h2 center">
+ Get free performance improvement.<br class="display-none-lg
display-block-md">
+ Get better syntax.<br class="display-block-lg display-none-md
display-block-sm">
+ Get more type safety.
+ </h2>
+ <div class="php8-button-wrapper center">
+ <a class="php8-button php8-button_light" href="#">Переходите на PHP
8!</a>
+ </div>
+ <div class="php8-footer__content">
+ <p>
+ For source downloads of PHP 8 please visit the <a
href="http://www.php.net/downloads">downloads</a> page.
+ Windows binaries can be found on the <a
href="http://windows.php.net/download">PHP for Windows</a> site.
+ The list of changes is recorded in the <a
href="http://www.php.net/ChangeLog-8.php">ChangeLog</a>.
+ </p>
+ <p>
+ The <a href="http://php.net/manual/en/migration8.php">migration
guide</a> is available in the PHP Manual. Please
+ consult it for a detailed list of new features and
backward-incompatible changes.
+ </p>
+ </div>
+ </div>
+</section>
+
+
+
+
+<?php site_footer();
\ No newline at end of file
--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php