com web/php: Adopt changes made to 8_0_x.php into 8_0_x_de.php: releases/8_0_x_de. php
| From: | Sara Golemon | Date: | Wed, 25 Nov 2020 20:28:13 +0000 |
| Subject: | com web/php: Adopt changes made to 8_0_x.php into 8_0_x_de.php: releases/8_0_x_de. php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-28865@lists.php.net to get a copy of this message | ||
Commit: dcad9427fa0e3f941da4f521f8b8f9d3ce0e0650
Author: Enno Woortmann <enno.woortmann@web.de> Wed, 25 Nov 2020 11:40:27 +0100
Committer: Sara Golemon <pollita@php.net> Wed, 25 Nov 2020 20:28:13 +0000
Parents: 55e6e15981bf513c5aab003dee9d56893ebf74eb
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=dcad9427fa0e3f941da4f521f8b8f9d3ce0e0650
Log:
Adopt changes made to 8_0_x.php into 8_0_x_de.php
Changed paths:
M releases/8_0_x_de.php
diff --git a/releases/8_0_x_de.php b/releases/8_0_x_de.php index 5f38b4c1b..19943e9f3 100644 --- a/releases/8_0_x_de.php +++ b/releases/8_0_x_de.php @@ -3,32 +3,28 @@ $_SERVER['BASE_PAGE'] = 'releases/8_0_x_de.php'; include_once __DIR__ . '/../include/prepend.inc'; if ($LANG === 'en') { - mirror_redirect("/releases/8_0_x.php?lang=$LANG"); - exit(); + mirror_redirect('/releases/8_0_x.php?lang=' . urlencode($LANG)); } -if ($LANG !== 'de' && file_exists("8_0_x_$LANG.php")) { - mirror_redirect("/releases/8_0_x_$LANG.php?lang=$LANG"); - exit(); +if (($LANG !== 'de') && file_exists(__DIR__ . '/8_0_x_' . basename($LANG) . '.php')) { + mirror_redirect('/releases/8_0_x_' . urlencode($LANG) . '.php?lang=' . urlencode($LANG)); } site_header("PHP 8.0.0 Release Announcement", array( - "current" => "php_8_0_x_de", - 'css' => array('php8.css'), - 'meta_tags' => array( - 'og:image' => $MYSITE . 'images/php8/php_8_released.png' - ) + "current" => "php_8_0_x_de", + 'css' => array('php8.css'), + 'meta_tags' => array( + 'og:image' => $MYSITE . 'images/php8/php_8_released.png' + ) )); ?> -<section> - <div class="page-tools"> - <div class="change-language"> - <?php echo release_language_chooser($LANG); ?> - </div> - </div> -</section> <section class="php8-section php8-section_dark php8-section_header center"> + <div class="page-tools"> + <div class="change-language"> + <?php echo release_language_chooser($LANG); ?> + </div> + </div> <div class="php8-section__content"> <div class="php8-logo"> <img src="/images/php8/logo_php8.svg" alt="php8" height="126" width="343"> @@ -41,7 +37,7 @@ site_header("PHP 8.0.0 Release Announcement", array( Konsistenz. </div> <div class="php8-button-wrapper center"> - <a class="php8-button php8-button_light" href="#">Wechsle jetzt zu PHP 8!</a> + <a class="php8-button php8-button_light" href="/downloads">Wechsle jetzt zu PHP 8!</a> </div> </div> </section> @@ -56,14 +52,20 @@ site_header("PHP 8.0.0 Release Announcement", array( <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> + <?php highlight_php_trimmed( + 'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);' + );?> </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> + <?php highlight_php_trimmed( + 'htmlspecialchars($string, double_encode: false);' + );?> </div> </div> </div> @@ -84,20 +86,24 @@ site_header("PHP 8.0.0 Release Announcement", array( <div class="php8-compare__block example-contents"> <div class="php8-compare__label">PHP 7</div> <div class="php8-code phpcode"> -<pre>/** + <?php highlight_php_trimmed( + '/** * @Route("/api/posts/{id}", methods={"GET", "HEAD"}) */ -classUser -{</pre> +class User +{' + );?> </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"])] + <?php highlight_php_trimmed( + '#[Route("/api/posts/{id}", methods: ["GET", "HEAD"])] class User -{</pre> +{' + );?> </div> </div> </div> @@ -115,34 +121,38 @@ class User <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; + <?php highlight_php_trimmed( + '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> +public function __construct( + float $x = 0.0, + float $y = 0.0, + float $z = 0.0, +) { + $this->x = $x; + $this->y = $y; + $this->z = $z; +} +}' + );?> </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> + <?php highlight_php_trimmed( + 'class Point { +public function __construct( + public float $x = 0.0, + public float $y = 0.0, + public float $z = 0.0, +) {} +}' + );?> </div> </div> </div> @@ -154,38 +164,42 @@ class User <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> + <a class="php8-rfc" href="https://wiki.php.net/rfc/union_types_v2">RFC</a> <a class="php8-rfc" href="/manual/en/language.types.declarations.php#language.types.declarations.union">Doc</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; + <?php highlight_php_trimmed( + 'class Number { +/** @var int|float */ +private $number; - /** - * @param float|int $number - */ - public function __construct($number) { - $this->number = $number; - } +/** + * @param float|int $number + */ +public function __construct($number) { + $this->number = $number; +} } -new Number('NaN'); // Ok</pre> +new Number(\'NaN\'); // Ok' + );?> </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 - ) {} + <?php highlight_php_trimmed( + 'class Number { +public function __construct( + private int|float $number +) {} } -new Number('NaN'); // TypeError</pre> +new Number(\'NaN\'); // TypeError' + );?> </div> </div> </div> @@ -204,27 +218,31 @@ new Number('NaN'); // TypeError</pre> <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 nein!"; - break; - case 8.0: - $result = "Das hier habe ich erwartet"; - break; + <?php highlight_php_trimmed( + 'switch (8.0) { +case \'8.0\': + $result = "Oh no!"; + break; +case 8.0: + $result = "This is what I expected"; + break; } echo $result; -//> Oh nein!</pre> +//> Oh no!' + );?> </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 nein!", - 8.0 => "Das hier habe ich erwartet", + <?php highlight_php_trimmed( + 'echo match (8.0) { +\'8.0\' => "Oh no!", +8.0 => "This is what I expected", }; -//> Das hier habe ich erwartet</pre> +//> This is what I expected' + );?> </div> </div> </div> @@ -248,26 +266,30 @@ echo $result; <div class="php8-compare__block example-contents"> <div class="php8-compare__label">PHP 7</div> <div class="php8-code phpcode"> -<pre>$country = null; + <?php highlight_php_trimmed( + '$country = null; if ($session !== null) { - $user = $session->user; +$user = $session->user; - if ($user !== null) { - $address = $user->getAddress(); +if ($user !== null) { + $address = $user->getAddress(); - if ($address !== null) { - $country = $address->country; - } - } -}</pre> + if ($address !== null) { + $country = $address->country; + } +} +}' + );?> </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> + <?php highlight_php_trimmed( + '$country = $session?->user?->getAddress()?->country;' + );?> </div> </div> </div> @@ -287,14 +309,18 @@ if ($session !== null) { <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> + <?php highlight_php_trimmed( + '0 == \'foobar\' // true' + );?> </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> + <?php highlight_php_trimmed( + '0 == \'foobar\' // false' + );?> </div> </div> </div> @@ -313,18 +339,22 @@ if ($session !== null) { <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 + <?php highlight_php_trimmed( + '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> +array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be greater than 0' + );?> </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 + <?php highlight_php_trimmed( + '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> +array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be greater than 0' + );?> </div> </div> </div> @@ -342,86 +372,79 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be mal bessere Performance in synthetischen Benchmarks und eine 1,5 bis zweifache Verbesserung in einigen speziellen, langlaufenden Anwendungen. Die Performance einer typischen Anwendung ist auf dem Niveau von PHP 7.4. </p> + <h3 class="php8-h3"> + Relativer Beitrag des JIT Compilers zur Performance von PHP 8 + </h3> <p> - <img src="/images/php8/jit.png" alt="Just-In-Time compilation"> + <img src="/images/php8/scheme.svg" width="900" alt="Just-In-Time compilation"> </p> - <h2 class="php8-h2 php8-h2_margin-top">Weitere Syntax-Anpassungen und Verbesserungen</h2> <div class="php8-columns"> <div class="php8-column"> + <h2 class="php8-h2 php8-h2_margin-top">Verbesserungen am Typen-System und an der Fehlerbehandlung</h2> <ul> <li> - Erlauben eines Abschließenden Kommas in Parameter-Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a> - und Closure Use Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>. + Striktere Typen-Checks für arithmetische/bitweise Operatoren + <a href="https://wiki.php.net/rfc/arithmetic_operator_type_checks">RFC</a> </li> <li> - Catches ohne Exception Variable <a href="http://TODO">RFC</a>. + Validierung abstrakter Methoden in einem Trait <a href="https://wiki.php.net/rfc/abstract_trait_method_validation">RFC</a> </li> <li> - Anpassungen an der Syntax für Variablen <a href="https://wiki.php.net/rfc/variable_syntax_tweaks">RFC</a>. - </li> - </ul> - </div> - <div class="php8-column"> - <ul> - <li> - Namespaces werden als ein Token ausgewertet <a href="https://wiki.php.net/rfc/namespaced_names_as_token">RFC</a>. + Korrekte Signaturen magischer Funktionen <a href="https://wiki.php.net/rfc/magic-methods-signature">RFC</a> </li> <li> - Throw kann als Ausdruck verwendet werden <a href="https://wiki.php.net/rfc/throw_expression">RFC</a>. + Neue Klassifizierung von Engine-Warnings <a href="https://wiki.php.net/rfc/engine_warnings">RFC</a> </li> <li> - Nutzung von ::class auf Objekten <a href="https://wiki.php.net/rfc/class_name_literal_on_object">RFC</a>. + Inkompatiblen Methoden-Signaturen erzeugen einen Fatal Error <a href="https://wiki.php.net/rfc/lsp_errors">RFC</a> </li> - </ul> - </div> - </div> - <div class="php8-columns"> - <div class="php8-column"> - <h2 class="php8-h2 php8-h2_margin-top">Verbesserungen am Typen-System und an der Fehlerbehandlung</h2> - <ul> <li> - Vernünftige String-zu-Zahl Vergleiche <a href="https://wiki.php.net/rfc/string_to_number_comparison">RFC</a>. + Der @ Operator unterdrückt keine Fatal Errors mehr. </li> <li> - Striktere Typen-Checks für arithmetische/bitweise Operatoren - <a href="https://wiki.php.net/rfc/arithmetic_operator_type_checks">RFC</a>. + Vererbung mit privaten Methoden <a href="https://wiki.php.net/rfc/inheritance_private_methods">RFC</a> </li> <li> - Validierung abstrakter Methoden in einem Trait <a href="http://TODO">RFC</a>. + Mixed Typ <a href="https://wiki.php.net/rfc/mixed_type_v2">RFC</a> </li> <li> - Korrekte Signaturen magischer Funktionen <a href="https://wiki.php.net/rfc/magic-methods-signature">RFC</a> + Static als Rückgabetyp <a href="https://wiki.php.net/rfc/static_return_type">RFC</a> </li> <li> - Neue Klassifizierung von Engine-Warnings <a href="https://wiki.php.net/rfc/engine_warnings">RFC</a>. + Typen für interne Funktionen + <a href="https://externals.io/message/106522">RFC</a> </li> <li> - Inkompatiblen Methoden-Signaturen erzeugen einen Fatal Error <a href="https://wiki.php.net/rfc/lsp_errors">RFC</a>. + Curl verwendet nun Objekte anstelle des resource Typs + <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">Weitere Syntax-Anpassungen und Verbesserungen</h2> + <ul> <li> - Der @ Operator unterdrückt keine Fatal Errors mehr. + Erlauben eines Abschließenden Kommas in Parameter-Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a> + und Closure Use Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>. </li> <li> - Vererbung mit privaten Methoden <a href="https://wiki.php.net/rfc/inheritance_private_methods">RFC</a>. + Catches ohne Exception-Variable <a href="https://wiki.php.net/rfc/non-capturing_catches">RFC</a> </li> <li> - Mixed Typ <a href="https://wiki.php.net/rfc/mixed_type_v2">RFC</a>. + Anpassungen an der Syntax für Variablen <a href="https://wiki.php.net/rfc/variable_syntax_tweaks">RFC</a> </li> <li> - Static als Rückgabetyp <a href="">RFC</a>. + Namespaces werden als ein Token ausgewertet <a href="https://wiki.php.net/rfc/namespaced_names_as_token">RFC</a> </li> <li> - Typen für interne Funktionen - <a href="https://externals.io/message/106522">RFC</a>. + Throw ist jetzt ein Ausdruck <a href="https://wiki.php.net/rfc/throw_expression">RFC</a> </li> <li> - Curl verwendet nun Objekte anstelle des resource Typs - <a href="https://php.watch/versions/8.0/resource-CurlHandle">RFC</a>. + Nutzung von ::class auf Objekten <a href="https://wiki.php.net/rfc/class_name_literal_on_object">RFC</a> </li> </ul> - </div> - <div class="php8-column"> + <h2 class="php8-h2 php8-h2_margin-top">Neue Klassen, Interfaces, und Funktionen</h2> <ul> <li> @@ -455,12 +478,10 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be <section class="php8-section php8-section_dark php8-section_footer php8-footer"> <div class="php8-section__content"> <h2 class="php8-h2 center"> - Erhalte Performance Optimierungen.<br class="display-none-lg display-block-md"> - Erhalte bessere Syntax.<br class="display-block-lg display-none-md display-block-sm"> - Erhalte mehr Typensicherheit. + Bessere Performance, bessere Syntax, optimierte Typsicherheit. </h2> <div class="php8-button-wrapper center"> - <a class="php8-button php8-button_light" href="#">Wechsle jetzt zu PHP 8!</a> + <a class="php8-button php8-button_light" href="/downloads">Wechsle jetzt zu PHP 8!</a> </div> <div class="php8-footer__content"> <p> @@ -469,7 +490,7 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be Die Liste der Änderungen ist im <a href="http://www.php.net/ChangeLog-8.php">ChangeLog</a> festgehalten. </p> <p> - Der <a href="http://php.net/manual/en/migration8.php">Migration Guide</a> ist im PHP Manual verfügbar. Lies dort + Der <a href="/manual/en/migration8.php">Migration Guide</a> ist im PHP Manual verfügbar. Lies dort nach für detaillierte Informationen zu den neuen Funktionen und inkompatiblen Änderungen zu vorherigen PHP Versionen. </p> @@ -480,4 +501,4 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be -<?php site_footer(); \ No newline at end of file +<?php site_footer();
diff --git a/releases/8_0_x_de.php b/releases/8_0_x_de.php index 5f38b4c1b..19943e9f3 100644 --- a/releases/8_0_x_de.php +++ b/releases/8_0_x_de.php @@ -3,32 +3,28 @@ $_SERVER['BASE_PAGE'] = 'releases/8_0_x_de.php'; include_once __DIR__ . '/../include/prepend.inc'; if ($LANG === 'en') { - mirror_redirect("/releases/8_0_x.php?lang=$LANG"); - exit(); + mirror_redirect('/releases/8_0_x.php?lang=' . urlencode($LANG)); } -if ($LANG !== 'de' && file_exists("8_0_x_$LANG.php")) { - mirror_redirect("/releases/8_0_x_$LANG.php?lang=$LANG"); - exit(); +if (($LANG !== 'de') && file_exists(__DIR__ . '/8_0_x_' . basename($LANG) . '.php')) { + mirror_redirect('/releases/8_0_x_' . urlencode($LANG) . '.php?lang=' . urlencode($LANG)); } site_header("PHP 8.0.0 Release Announcement", array( - "current" => "php_8_0_x_de", - 'css' => array('php8.css'), - 'meta_tags' => array( - 'og:image' => $MYSITE . 'images/php8/php_8_released.png' - ) + "current" => "php_8_0_x_de", + 'css' => array('php8.css'), + 'meta_tags' => array( + 'og:image' => $MYSITE . 'images/php8/php_8_released.png' + ) )); ?> -<section> - <div class="page-tools"> - <div class="change-language"> - <?php echo release_language_chooser($LANG); ?> - </div> - </div> -</section> <section class="php8-section php8-section_dark php8-section_header center"> + <div class="page-tools"> + <div class="change-language"> + <?php echo release_language_chooser($LANG); ?> + </div> + </div> <div class="php8-section__content"> <div class="php8-logo"> <img src="/images/php8/logo_php8.svg" alt="php8" height="126" width="343"> @@ -41,7 +37,7 @@ site_header("PHP 8.0.0 Release Announcement", array( Konsistenz. </div> <div class="php8-button-wrapper center"> - <a class="php8-button php8-button_light" href="#">Wechsle jetzt zu PHP 8!</a> + <a class="php8-button php8-button_light" href="/downloads">Wechsle jetzt zu PHP 8!</a> </div> </div> </section> @@ -56,14 +52,20 @@ site_header("PHP 8.0.0 Release Announcement", array( <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> + <?php highlight_php_trimmed( + 'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);' + );?> </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> + <?php highlight_php_trimmed( + 'htmlspecialchars($string, double_encode: false);' + );?> </div> </div> </div> @@ -84,20 +86,24 @@ site_header("PHP 8.0.0 Release Announcement", array( <div class="php8-compare__block example-contents"> <div class="php8-compare__label">PHP 7</div> <div class="php8-code phpcode"> -<pre>/** + <?php highlight_php_trimmed( + '/** * @Route("/api/posts/{id}", methods={"GET", "HEAD"}) */ -classUser -{</pre> +class User +{' + );?> </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"])] + <?php highlight_php_trimmed( + '#[Route("/api/posts/{id}", methods: ["GET", "HEAD"])] class User -{</pre> +{' + );?> </div> </div> </div> @@ -115,34 +121,38 @@ class User <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; + <?php highlight_php_trimmed( + '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> +public function __construct( + float $x = 0.0, + float $y = 0.0, + float $z = 0.0, +) { + $this->x = $x; + $this->y = $y; + $this->z = $z; +} +}' + );?> </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> + <?php highlight_php_trimmed( + 'class Point { +public function __construct( + public float $x = 0.0, + public float $y = 0.0, + public float $z = 0.0, +) {} +}' + );?> </div> </div> </div> @@ -154,38 +164,42 @@ class User <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> + <a class="php8-rfc" href="https://wiki.php.net/rfc/union_types_v2">RFC</a> <a class="php8-rfc" href="/manual/en/language.types.declarations.php#language.types.declarations.union">Doc</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; + <?php highlight_php_trimmed( + 'class Number { +/** @var int|float */ +private $number; - /** - * @param float|int $number - */ - public function __construct($number) { - $this->number = $number; - } +/** + * @param float|int $number + */ +public function __construct($number) { + $this->number = $number; +} } -new Number('NaN'); // Ok</pre> +new Number(\'NaN\'); // Ok' + );?> </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 - ) {} + <?php highlight_php_trimmed( + 'class Number { +public function __construct( + private int|float $number +) {} } -new Number('NaN'); // TypeError</pre> +new Number(\'NaN\'); // TypeError' + );?> </div> </div> </div> @@ -204,27 +218,31 @@ new Number('NaN'); // TypeError</pre> <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 nein!"; - break; - case 8.0: - $result = "Das hier habe ich erwartet"; - break; + <?php highlight_php_trimmed( + 'switch (8.0) { +case \'8.0\': + $result = "Oh no!"; + break; +case 8.0: + $result = "This is what I expected"; + break; } echo $result; -//> Oh nein!</pre> +//> Oh no!' + );?> </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 nein!", - 8.0 => "Das hier habe ich erwartet", + <?php highlight_php_trimmed( + 'echo match (8.0) { +\'8.0\' => "Oh no!", +8.0 => "This is what I expected", }; -//> Das hier habe ich erwartet</pre> +//> This is what I expected' + );?> </div> </div> </div> @@ -248,26 +266,30 @@ echo $result; <div class="php8-compare__block example-contents"> <div class="php8-compare__label">PHP 7</div> <div class="php8-code phpcode"> -<pre>$country = null; + <?php highlight_php_trimmed( + '$country = null; if ($session !== null) { - $user = $session->user; +$user = $session->user; - if ($user !== null) { - $address = $user->getAddress(); +if ($user !== null) { + $address = $user->getAddress(); - if ($address !== null) { - $country = $address->country; - } - } -}</pre> + if ($address !== null) { + $country = $address->country; + } +} +}' + );?> </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> + <?php highlight_php_trimmed( + '$country = $session?->user?->getAddress()?->country;' + );?> </div> </div> </div> @@ -287,14 +309,18 @@ if ($session !== null) { <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> + <?php highlight_php_trimmed( + '0 == \'foobar\' // true' + );?> </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> + <?php highlight_php_trimmed( + '0 == \'foobar\' // false' + );?> </div> </div> </div> @@ -313,18 +339,22 @@ if ($session !== null) { <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 + <?php highlight_php_trimmed( + '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> +array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be greater than 0' + );?> </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 + <?php highlight_php_trimmed( + '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> +array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be greater than 0' + );?> </div> </div> </div> @@ -342,86 +372,79 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be mal bessere Performance in synthetischen Benchmarks und eine 1,5 bis zweifache Verbesserung in einigen speziellen, langlaufenden Anwendungen. Die Performance einer typischen Anwendung ist auf dem Niveau von PHP 7.4. </p> + <h3 class="php8-h3"> + Relativer Beitrag des JIT Compilers zur Performance von PHP 8 + </h3> <p> - <img src="/images/php8/jit.png" alt="Just-In-Time compilation"> + <img src="/images/php8/scheme.svg" width="900" alt="Just-In-Time compilation"> </p> - <h2 class="php8-h2 php8-h2_margin-top">Weitere Syntax-Anpassungen und Verbesserungen</h2> <div class="php8-columns"> <div class="php8-column"> + <h2 class="php8-h2 php8-h2_margin-top">Verbesserungen am Typen-System und an der Fehlerbehandlung</h2> <ul> <li> - Erlauben eines Abschließenden Kommas in Parameter-Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a> - und Closure Use Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>. + Striktere Typen-Checks für arithmetische/bitweise Operatoren + <a href="https://wiki.php.net/rfc/arithmetic_operator_type_checks">RFC</a> </li> <li> - Catches ohne Exception Variable <a href="http://TODO">RFC</a>. + Validierung abstrakter Methoden in einem Trait <a href="https://wiki.php.net/rfc/abstract_trait_method_validation">RFC</a> </li> <li> - Anpassungen an der Syntax für Variablen <a href="https://wiki.php.net/rfc/variable_syntax_tweaks">RFC</a>. - </li> - </ul> - </div> - <div class="php8-column"> - <ul> - <li> - Namespaces werden als ein Token ausgewertet <a href="https://wiki.php.net/rfc/namespaced_names_as_token">RFC</a>. + Korrekte Signaturen magischer Funktionen <a href="https://wiki.php.net/rfc/magic-methods-signature">RFC</a> </li> <li> - Throw kann als Ausdruck verwendet werden <a href="https://wiki.php.net/rfc/throw_expression">RFC</a>. + Neue Klassifizierung von Engine-Warnings <a href="https://wiki.php.net/rfc/engine_warnings">RFC</a> </li> <li> - Nutzung von ::class auf Objekten <a href="https://wiki.php.net/rfc/class_name_literal_on_object">RFC</a>. + Inkompatiblen Methoden-Signaturen erzeugen einen Fatal Error <a href="https://wiki.php.net/rfc/lsp_errors">RFC</a> </li> - </ul> - </div> - </div> - <div class="php8-columns"> - <div class="php8-column"> - <h2 class="php8-h2 php8-h2_margin-top">Verbesserungen am Typen-System und an der Fehlerbehandlung</h2> - <ul> <li> - Vernünftige String-zu-Zahl Vergleiche <a href="https://wiki.php.net/rfc/string_to_number_comparison">RFC</a>. + Der @ Operator unterdrückt keine Fatal Errors mehr. </li> <li> - Striktere Typen-Checks für arithmetische/bitweise Operatoren - <a href="https://wiki.php.net/rfc/arithmetic_operator_type_checks">RFC</a>. + Vererbung mit privaten Methoden <a href="https://wiki.php.net/rfc/inheritance_private_methods">RFC</a> </li> <li> - Validierung abstrakter Methoden in einem Trait <a href="http://TODO">RFC</a>. + Mixed Typ <a href="https://wiki.php.net/rfc/mixed_type_v2">RFC</a> </li> <li> - Korrekte Signaturen magischer Funktionen <a href="https://wiki.php.net/rfc/magic-methods-signature">RFC</a> + Static als Rückgabetyp <a href="https://wiki.php.net/rfc/static_return_type">RFC</a> </li> <li> - Neue Klassifizierung von Engine-Warnings <a href="https://wiki.php.net/rfc/engine_warnings">RFC</a>. + Typen für interne Funktionen + <a href="https://externals.io/message/106522">RFC</a> </li> <li> - Inkompatiblen Methoden-Signaturen erzeugen einen Fatal Error <a href="https://wiki.php.net/rfc/lsp_errors">RFC</a>. + Curl verwendet nun Objekte anstelle des resource Typs + <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">Weitere Syntax-Anpassungen und Verbesserungen</h2> + <ul> <li> - Der @ Operator unterdrückt keine Fatal Errors mehr. + Erlauben eines Abschließenden Kommas in Parameter-Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a> + und Closure Use Listen <a href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>. </li> <li> - Vererbung mit privaten Methoden <a href="https://wiki.php.net/rfc/inheritance_private_methods">RFC</a>. + Catches ohne Exception-Variable <a href="https://wiki.php.net/rfc/non-capturing_catches">RFC</a> </li> <li> - Mixed Typ <a href="https://wiki.php.net/rfc/mixed_type_v2">RFC</a>. + Anpassungen an der Syntax für Variablen <a href="https://wiki.php.net/rfc/variable_syntax_tweaks">RFC</a> </li> <li> - Static als Rückgabetyp <a href="">RFC</a>. + Namespaces werden als ein Token ausgewertet <a href="https://wiki.php.net/rfc/namespaced_names_as_token">RFC</a> </li> <li> - Typen für interne Funktionen - <a href="https://externals.io/message/106522">RFC</a>. + Throw ist jetzt ein Ausdruck <a href="https://wiki.php.net/rfc/throw_expression">RFC</a> </li> <li> - Curl verwendet nun Objekte anstelle des resource Typs - <a href="https://php.watch/versions/8.0/resource-CurlHandle">RFC</a>. + Nutzung von ::class auf Objekten <a href="https://wiki.php.net/rfc/class_name_literal_on_object">RFC</a> </li> </ul> - </div> - <div class="php8-column"> + <h2 class="php8-h2 php8-h2_margin-top">Neue Klassen, Interfaces, und Funktionen</h2> <ul> <li> @@ -455,12 +478,10 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be <section class="php8-section php8-section_dark php8-section_footer php8-footer"> <div class="php8-section__content"> <h2 class="php8-h2 center"> - Erhalte Performance Optimierungen.<br class="display-none-lg display-block-md"> - Erhalte bessere Syntax.<br class="display-block-lg display-none-md display-block-sm"> - Erhalte mehr Typensicherheit. + Bessere Performance, bessere Syntax, optimierte Typsicherheit. </h2> <div class="php8-button-wrapper center"> - <a class="php8-button php8-button_light" href="#">Wechsle jetzt zu PHP 8!</a> + <a class="php8-button php8-button_light" href="/downloads">Wechsle jetzt zu PHP 8!</a> </div> <div class="php8-footer__content"> <p> @@ -469,7 +490,7 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be Die Liste der Änderungen ist im <a href="http://www.php.net/ChangeLog-8.php">ChangeLog</a> festgehalten. </p> <p> - Der <a href="http://php.net/manual/en/migration8.php">Migration Guide</a> ist im PHP Manual verfügbar. Lies dort + Der <a href="/manual/en/migration8.php">Migration Guide</a> ist im PHP Manual verfügbar. Lies dort nach für detaillierte Informationen zu den neuen Funktionen und inkompatiblen Änderungen zu vorherigen PHP Versionen. </p> @@ -480,4 +501,4 @@ array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be -<?php site_footer(); \ No newline at end of file +<?php site_footer();