Commit: d54880319a543171ac20113e93af80ba2fa82bf9 Author: Ruslan <[email protected]> Sat, 7 Nov 2020 17:54:14 +0300 Committer: Sara Golemon <[email protected]> Wed, 25 Nov 2020 20:28:13 +0000 Parents: 47329e8762a694a033074ef9ce440d125883ec74 Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=d54880319a543171ac20113e93af80ba2fa82bf9 Log: JS-13812 Develop markup for PHP 8 announcement on php.net Changed paths: D images/anchor.svg D images/icon_arrow.svg D images/logos/logo_php8.svg D images/party-popper.png D images/[email protected] D images/[email protected] A images/php8/anchor.svg A images/php8/icon_arrow.svg A images/php8/jit.png A images/php8/logo_php8.svg A images/php8/party-popper.png A images/php8/[email protected] A images/php8/[email protected] M include/header.inc M php8.php M styles/php8.css
diff --git a/images/anchor.svg b/images/anchor.svg deleted file mode 100644 index aade786a7..000000000 --- a/images/anchor.svg +++ /dev/null @@ -1,6 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="21" height="16" viewBox="0 0 21 16"> - <g fill="#505C90" fill-rule="evenodd"> - <path d="M18.914 1.328c-1.771-1.77-4.643-1.77-6.414 0L8 5.828l1.414 1.414 4.5-4.5c.99-.99 2.596-.99 3.586 0 .99.99.99 2.596 0 3.586l-4.5 4.5 1.414 1.414 4.5-4.5c1.77-1.771 1.77-4.643 0-6.414z" transform="translate(-622 -1049) translate(622 1049)"/> - <path d="M6.328 12.5c-.64.643-1.574.894-2.45.66-.877-.234-1.561-.919-1.796-1.795-.234-.876.018-1.81.66-2.45l4.5-4.5L5.828 3l-4.5 4.5c-1.77 1.771-1.77 4.643 0 6.414 1.772 1.771 4.643 1.771 6.414 0l4.5-4.5L10.828 8l-4.5 4.5z" transform="translate(-622 -1049) translate(622 1049)"/> - </g> -</svg> diff --git a/images/icon_arrow.svg b/images/icon_arrow.svg deleted file mode 100644 index b02bdd6c6..000000000 --- a/images/icon_arrow.svg +++ /dev/null @@ -1,5 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="19" height="36" viewBox="0 0 19 36"> - <g fill="none" fill-rule="evenodd" stroke-linecap="square" opacity=".6" stroke="#979797"> - <path d="M.528.514L18.472 18M18.472 18L.528 35.486" transform="translate(-709 -793) translate(709 793)"/> - </g> -</svg> diff --git a/images/logos/logo_php8.svg b/images/logos/logo_php8.svg deleted file mode 100644 index ce8cbe861..000000000 --- a/images/logos/logo_php8.svg +++ /dev/null @@ -1,7 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" width="343" height="126" viewBox="0 0 343 126"> - <g fill="#FFF"> - <path d="M51.064 41.386c7.962 0 13.268 1.468 15.921 4.408 2.652 2.94 3.283 7.986 1.896 15.136-1.45 7.446-4.238 12.761-8.375 15.945-4.136 3.185-10.43 4.775-18.879 4.775H28.879l7.825-40.264h14.36zM0 122.41h20.958l4.972-25.578h17.95c7.922 0 14.437-.83 19.554-2.496 5.115-1.662 9.763-4.453 13.948-8.37 3.513-3.227 6.353-6.788 8.53-10.682 2.173-3.89 3.718-8.186 4.631-12.885 2.217-11.404.543-20.287-5.016-26.65C79.97 29.386 71.124 26.204 59 26.204H18.7L0 122.41M105.935.626h20.792l-4.971 25.578h18.523c11.656 0 19.695 2.033 24.12 6.098 4.424 4.065 5.75 10.654 3.98 19.761l-8.7 44.77h-21.122l8.271-42.568c.942-4.842.597-8.145-1.039-9.907-1.634-1.761-5.112-2.642-10.432-2.642h-16.618l-10.71 55.116H87.234l18.7-96.206M214.643 41.386c7.962 0 13.268 1.468 15.921 4.408 2.652 2.94 3.284 7.986 1.896 15.136-1.45 7.446-4.238 12.761-8.375 15.945-4.136 3.185-10.43 4.775-18.879 4.775h-12.748l7.825-40.264h14.36zm-51.064 81.024h20.958l4.97-25.578h17.952c7.92 0 14.436-.83 19.553-2.496 5.115-1.662 9.764-4.453 13.949-8.37 3.512-3.227 6.353-6.788 8.53-10.682 2.173-3.89 3.718-8.186 4.63-12.885 2.218-11.404.545-20.287-5.014-26.65-5.56-6.363-14.404-9.545-26.528-9.545h-40.302L163.58 122.41" transform="translate(-548 -112) translate(548 112) translate(0 3)"/> - <path d="M316.964 48.124c-5.653-13.604-10.537-25.357-5.765-33.57 1.773-2.492 3.8-3.755 6.022-3.755 4.474 0 8.56 4.893 8.6 4.943l5.701 6.92-3.564-8.225C327.702 13.847 321.573 0 310.573 0c-3.847 0-7.787 1.732-11.71 5.146l-.125.127c-9.51 10.993-.159 31.75 8.091 50.062l.02.044 6.122 14.232s.64.51 0 0c2.837 7.27 5.561 16.01 3.86 22.373-2.648 9.976-11.504 16.849-11.593 16.917l-5.736 4.393 6.887-2.184c.651-.206 16.007-5.212 19.685-18.518 2.301-10.89-.596-21.788-3.531-30.233.382-.315-.393.333 0 0l-5.348-13.677" transform="translate(-548 -112) translate(548 112)"/> - </g> - <path fill="#0F0F0F" d="M333.91 9.388l-7.136-7.79 5.096 9.254c.064.115 6.257 11.682-1.563 25.209-2.945 4.166-7.35 8.407-13.112 12.62l-10.365 6.656c-.111-.248-.056-.124 0-.002l-.365.264.053-.01-.053.01C295 62.194 284.278 66.235 284.099 66.306c-15.94 7.096-25.877 18.145-27.261 30.313-1.05 9.23 3.168 18.153 11.572 24.482l.11.074c5.283 3.17 10.999 4.778 16.987 4.778 15.74 0 28.016-10.891 28.532-11.356l7.654-6.893-9.093 4.838c-.077.04-7.65 4.02-15.569 4.02-7.06 0-12.14-3.149-15.101-9.36-3.783-13.45 9.477-22.629 24.826-33.25 2.037-1.41 4.133-2.86 6.215-4.34.012.033.116-.119.13-.086l9.084-6.75c.137-.214.37-.38.358-.417 7.548-6.222 17.414-15.901 19.717-29.482 1.781-12.267-7.937-23.037-8.35-23.49z" transform="translate(-548 -112) translate(548 112)"/> -</svg> diff --git a/images/party-popper.png b/images/party-popper.png deleted file mode 100644 index 031d8b594..000000000 Binary files a/images/party-popper.png and /dev/null differ diff --git a/images/[email protected] b/images/[email protected] deleted file mode 100644 index e3f00a530..000000000 Binary files a/images/[email protected] and /dev/null differ diff --git a/images/[email protected] b/images/[email protected] deleted file mode 100644 index 1632170c1..000000000 Binary files a/images/[email protected] and /dev/null differ diff --git a/images/php8/anchor.svg b/images/php8/anchor.svg new file mode 100644 index 000000000..aade786a7 --- /dev/null +++ b/images/php8/anchor.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="21" height="16" viewBox="0 0 21 16"> + <g fill="#505C90" fill-rule="evenodd"> + <path d="M18.914 1.328c-1.771-1.77-4.643-1.77-6.414 0L8 5.828l1.414 1.414 4.5-4.5c.99-.99 2.596-.99 3.586 0 .99.99.99 2.596 0 3.586l-4.5 4.5 1.414 1.414 4.5-4.5c1.77-1.771 1.77-4.643 0-6.414z" transform="translate(-622 -1049) translate(622 1049)"/> + <path d="M6.328 12.5c-.64.643-1.574.894-2.45.66-.877-.234-1.561-.919-1.796-1.795-.234-.876.018-1.81.66-2.45l4.5-4.5L5.828 3l-4.5 4.5c-1.77 1.771-1.77 4.643 0 6.414 1.772 1.771 4.643 1.771 6.414 0l4.5-4.5L10.828 8l-4.5 4.5z" transform="translate(-622 -1049) translate(622 1049)"/> + </g> +</svg> diff --git a/images/php8/icon_arrow.svg b/images/php8/icon_arrow.svg new file mode 100644 index 000000000..b02bdd6c6 --- /dev/null +++ b/images/php8/icon_arrow.svg @@ -0,0 +1,5 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="19" height="36" viewBox="0 0 19 36"> + <g fill="none" fill-rule="evenodd" stroke-linecap="square" opacity=".6" stroke="#979797"> + <path d="M.528.514L18.472 18M18.472 18L.528 35.486" transform="translate(-709 -793) translate(709 793)"/> + </g> +</svg> diff --git a/images/php8/jit.png b/images/php8/jit.png new file mode 100644 index 000000000..05e4be540 Binary files /dev/null and b/images/php8/jit.png differ diff --git a/images/php8/logo_php8.svg b/images/php8/logo_php8.svg new file mode 100644 index 000000000..ce8cbe861 --- /dev/null +++ b/images/php8/logo_php8.svg @@ -0,0 +1,7 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="343" height="126" viewBox="0 0 343 126"> + <g fill="#FFF"> + <path d="M51.064 41.386c7.962 0 13.268 1.468 15.921 4.408 2.652 2.94 3.283 7.986 1.896 15.136-1.45 7.446-4.238 12.761-8.375 15.945-4.136 3.185-10.43 4.775-18.879 4.775H28.879l7.825-40.264h14.36zM0 122.41h20.958l4.972-25.578h17.95c7.922 0 14.437-.83 19.554-2.496 5.115-1.662 9.763-4.453 13.948-8.37 3.513-3.227 6.353-6.788 8.53-10.682 2.173-3.89 3.718-8.186 4.631-12.885 2.217-11.404.543-20.287-5.016-26.65C79.97 29.386 71.124 26.204 59 26.204H18.7L0 122.41M105.935.626h20.792l-4.971 25.578h18.523c11.656 0 19.695 2.033 24.12 6.098 4.424 4.065 5.75 10.654 3.98 19.761l-8.7 44.77h-21.122l8.271-42.568c.942-4.842.597-8.145-1.039-9.907-1.634-1.761-5.112-2.642-10.432-2.642h-16.618l-10.71 55.116H87.234l18.7-96.206M214.643 41.386c7.962 0 13.268 1.468 15.921 4.408 2.652 2.94 3.284 7.986 1.896 15.136-1.45 7.446-4.238 12.761-8.375 15.945-4.136 3.185-10.43 4.775-18.879 4.775h-12.748l7.825-40.264h14.36zm-51.064 81.024h20.958l4.97-25.578h17.952c7.92 0 14.436-.83 19.553-2.496 5.115-1.662 9.764-4.453 13.949-8.37 3.512-3.227 6.353-6.788 8.53-10.682 2.173-3.89 3.718-8.186 4.63-12.885 2.218-11.404.545-20.287-5.014-26.65-5.56-6.363-14.404-9.545-26.528-9.545h-40.302L163.58 122.41" transform="translate(-548 -112) translate(548 112) translate(0 3)"/> + <path d="M316.964 48.124c-5.653-13.604-10.537-25.357-5.765-33.57 1.773-2.492 3.8-3.755 6.022-3.755 4.474 0 8.56 4.893 8.6 4.943l5.701 6.92-3.564-8.225C327.702 13.847 321.573 0 310.573 0c-3.847 0-7.787 1.732-11.71 5.146l-.125.127c-9.51 10.993-.159 31.75 8.091 50.062l.02.044 6.122 14.232s.64.51 0 0c2.837 7.27 5.561 16.01 3.86 22.373-2.648 9.976-11.504 16.849-11.593 16.917l-5.736 4.393 6.887-2.184c.651-.206 16.007-5.212 19.685-18.518 2.301-10.89-.596-21.788-3.531-30.233.382-.315-.393.333 0 0l-5.348-13.677" transform="translate(-548 -112) translate(548 112)"/> + </g> + <path fill="#0F0F0F" d="M333.91 9.388l-7.136-7.79 5.096 9.254c.064.115 6.257 11.682-1.563 25.209-2.945 4.166-7.35 8.407-13.112 12.62l-10.365 6.656c-.111-.248-.056-.124 0-.002l-.365.264.053-.01-.053.01C295 62.194 284.278 66.235 284.099 66.306c-15.94 7.096-25.877 18.145-27.261 30.313-1.05 9.23 3.168 18.153 11.572 24.482l.11.074c5.283 3.17 10.999 4.778 16.987 4.778 15.74 0 28.016-10.891 28.532-11.356l7.654-6.893-9.093 4.838c-.077.04-7.65 4.02-15.569 4.02-7.06 0-12.14-3.149-15.101-9.36-3.783-13.45 9.477-22.629 24.826-33.25 2.037-1.41 4.133-2.86 6.215-4.34.012.033.116-.119.13-.086l9.084-6.75c.137-.214.37-.38.358-.417 7.548-6.222 17.414-15.901 19.717-29.482 1.781-12.267-7.937-23.037-8.35-23.49z" transform="translate(-548 -112) translate(548 112)"/> +</svg> diff --git a/images/php8/party-popper.png b/images/php8/party-popper.png new file mode 100644 index 000000000..031d8b594 Binary files /dev/null and b/images/php8/party-popper.png differ diff --git a/images/php8/[email protected] b/images/php8/[email protected] new file mode 100644 index 000000000..e3f00a530 Binary files /dev/null and b/images/php8/[email protected] differ diff --git a/images/php8/[email protected] b/images/php8/[email protected] new file mode 100644 index 000000000..1632170c1 Binary files /dev/null and b/images/php8/[email protected] differ diff --git a/include/header.inc b/include/header.inc index ed5aa63b3..5ab70c996 100644 --- a/include/header.inc +++ b/include/header.inc @@ -118,7 +118,7 @@ if (!isset($config["languages"])) { <li class="<?php echo $curr == "help" ? "active" : ""?>"><a href="/support">Help</a></li> <li class="<?php echo $curr == "php8" ? "active" : "" ?>"> <a href="/php8"> - <img src="/images/logos/logo_php8.svg" alt="php8" height="22" width="60"> + <img src="/images/php8/logo_php8.svg" alt="php8" height="22" width="60"> </a> </li> </ul> diff --git a/php8.php b/php8.php index df6cf6204..43df1e4fd 100644 --- a/php8.php +++ b/php8.php @@ -2,453 +2,424 @@ $_SERVER['BASE_PAGE'] = 'php8.php'; include_once __DIR__ . '/include/prepend.inc'; -site_header("PHP 8", array("current" => "php8")); +site_header("PHP 8", array("current" => "php8", 'css' => array('php8.css'))); ?> -<link rel="stylesheet" href="/styles/php8.css"> -<div class="php8"> - <div class="php8-section php8-section_dark php8-section_header center"> - <div class="php8-section__inner"> - <div class="php8-logo"> - <img src="/images/logos/logo_php8.svg" alt="" height="126" width="343"> - </div> - <div class="php8-title"> - <span class="php8-title__text">released!</span> - <img class="php8-title__img" src="/images/party-popper.png" srcset="/images/[email protected] 2x, /images/[email protected] 3x" alt="" width="58" height="58"> - </div> - <div class="php8-subtitle"> - PHP 8.0 is a major update of the PHP language. It contains many new features and optimizations. Including named - arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and - improvements in type system, error handling, and consistency. - </div> +<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"> + <span class="php8-title__text">released!</span> + <img class="php8-title__img" src="/images/php8/party-popper.png" srcset="/images/php8/[email protected] 2x, /images/php8/[email protected] 3x" alt="" width="58" height="58"> + </div> + <div class="php8-subtitle"> + PHP 8.0 is a major update of the PHP language. It contains many new features and optimizations. Including named + arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and + improvements in type system, error handling, and consistency. </div> </div> +</section> - <div class="php8-section center"> - <div class="php8-compare"> - <h2 class="php8-h2" id="named-arguments"> - <a class="php8-anchor" href="#named-arguments"></a> - 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"> - <code> - <span class="default">htmlspecialchars</span>(<span class="default">$string</span>, - <span class="default">ENT_COMPAT | ENT_HTML401</span>, <span class="string">'UTF-8'</span>, - <span class="keyword">false</span>); - </code> - </div> +<section class="php8-section center"> + <div class="php8-compare"> + <h2 class="php8-h2" id="named-arguments"> + <a class="php8-anchor" href="#named-arguments"></a> + 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 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"> - <code> - <span class="methodname"><strong>htmlspecialchars</strong></span>(<span class="parameter">$string</span>, - double_encode: <span class="initializer">false</span>); - </code> - </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> - <div class="php8-compare"> - <h2 class="php8-h2" id="attributes"> - <a class="php8-anchor" href="#attributes"></a> - 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"> - <code> - <span class="comment">/**</span><br> - <span class="comment">* @Route("/api/posts/{id}", methods={"GET", "HEAD"})</span><br> - <span class="comment">*/</span><br> - <span class="keyword">class</span> <span class="default">User</span><br> - { - </code> - </div> + <div class="php8-compare"> + <h2 class="php8-h2" id="attributes"> + <a class="php8-anchor" href="#attributes"></a> + 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 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"> - <code> - #[Route(<span class="string">"/api/posts/{id}"</span>, - methods: [<span class="string">"GET"</span>, <span class="string">"HEAD"</span>])]<br> - <span class="keyword">class</span> <span class="default">User</span><br> - {<br> - </code> - </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> + + <div class="php8-compare"> + <h2 class="php8-h2" id="constructor-property-promotion"> + <a class="php8-anchor" href="#constructor-property-promotion"></a> + 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; - <div class="php8-compare"> - <h2 class="php8-h2" id="constructor-property-promotion"> - <a class="php8-anchor" href="#constructor-property-promotion"></a> - 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"> - <code> - <span class="keyword">class</span> Point {<br> - <span class="keyword">public</span> <span class="keyword">float</span> $x;<br> - <span class="keyword">public</span> <span class="keyword">float</span> $y;<br> - <span class="keyword">public</span> <span class="keyword">float</span> $z;<br> - <br> - <span class="keyword">public</span> <span class="keyword">function</span> __construct(<br> - <span class="keyword">float</span> $x = 0.0,<br> - <span class="keyword">float</span> $y = 0.0,<br> - <span class="keyword">float</span> $z = 0.0,<br> - ) {<br> - $this->x = $x;<br> - $this->y = $y;<br> - $this->z = $z;<br> - }<br> - } - </code> - </div> + 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 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"> - <code> - <span class="keyword">class</span> Point {<br> - <span class="keyword">public</span> <span class="keyword">function</span> __construct(<br> - <span class="keyword">public</span> <span class="keyword">float</span> $x = 0.0,<br> - <span class="keyword">public</span> <span class="keyword">float</span> $y = 0.0,<br> - <span class="keyword">public</span> <span class="keyword">float</span> $z = 0.0,<br> - ) {}<br> - } - </code> - </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> + + <div class="php8-compare"> + <h2 class="php8-h2" id="union-types"> + <a class="php8-anchor" href="#union-types"></a> + 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; - <div class="php8-compare"> - <h2 class="php8-h2" id="union-types"> - <a class="php8-anchor" href="#union-types"></a> - 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"> - <code> - <span class="keyword">class</span> Number {<br> - <span class="comment">/** @var int|float */</span><br> - <span class="keyword">private</span> $number;<br> - <br> - <span class="comment">/**</span><br> - <span class="comment">* @param float|int $number</span><br> - <span class="comment">*/</span><br> - <span class="keyword">public</span> function __construct($number) {<br> - $this->number = $number;<br> - }<br> - }<br> - <br> - <span class="keyword">new</span> Number(<span class="string">'NaN'</span>); <span class="comment">// Ok</span> - </code> - </div> + /** + * @param float|int $number + */ + public function __construct($number) { + $this->number = $number; + } +} + +new Number('NaN'); // Ok</pre> </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"> - <code> - <span class="keyword">class</span> Number {<br> - <span class="keyword">public</span> function __construct(<br> - <span class="keyword">private</span> <span class="keyword">int</span>|<span class="keyword">float</span> $number<br> - ) {} - }<br> - <br> - <span class="keyword">new</span> Number(<span class="string">'NaN'</span>); <span class="comment">// TypeError</span> - </code> - </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> - <div class="php8-compare"> - <h2 class="php8-h2" id="match-expression"> - <a class="php8-anchor" href="#match-expression"></a> - 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"> - <code> - <span class="keyword">switch</span> (8.0) {<br> - <span class="keyword">case</span> <span class="string">'8.0'</span>:<br> - $result = <span class="string">"Oh no!"</span>;<br> - <span class="keyword">break</span>;<br> - <span class="keyword">case</span> 8.0:<br> - $result = <span class="string">"This is what I expected"</span>;<br> - <span class="keyword">break</span>;<br> - }<br> - <span class="keyword">echo</span> $result;<br> - <span class="comment">//> Oh no!</span> - </code> - </div> + <div class="php8-compare"> + <h2 class="php8-h2" id="match-expression"> + <a class="php8-anchor" href="#match-expression"></a> + 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 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"> - <code> - <span class="keyword">echo</span> match (8.0) {<br> - <span class="string">'8.0'</span> => <span class="string">"Oh no!"</span>,<br> - 8.0 => <span class="string">"This is what I expected"</span>,<br> - };<br> - <span class="comment">//> This is what I expected</span> - </code> - </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> + + <div class="php8-compare"> + <h2 class="php8-h2" id="nullsafe-operator"> + <a class="php8-anchor" href="#nullsafe-operator"></a> + 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; - <div class="php8-compare"> - <h2 class="php8-h2" id="nullsafe-operator"> - <a class="php8-anchor" href="#nullsafe-operator"></a> - 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"> - <code> - $country = <span class="keyword">null</span>;<br> - <br> - <span class="keyword">if</span> ($session !== <span class="keyword">null</span>) {<br> - $user = $session->user;<br> - <br> - <span class="keyword">if</span> ($user !== <span class="keyword">null</span>) {<br> - $address = $user->getAddress();<br> - <br> - <span class="keyword">if</span> ($address !== <span class="keyword">null</span>) {<br> - $country = $address->country;<br> - }<br> - }<br> - } - </code> - </div> +if ($session !== null) { + $user = $session->user; + + if ($user !== null) { + $address = $user->getAddress(); + + if ($address !== null) { + $country = $address->country; + } + } +}</pre> </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"> - <code> - $country = $session?->user?->getAddress()?->country; - </code> - </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> - <div class="php8-compare"> - <h2 class="php8-h2" id="saner-string-to-number-comparisons"> - <a class="php8-anchor" href="#saner-string-to-number-comparisons"></a> - 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"> - <code> - 0 == <span class="string">'foobar'</span> <span class="comment">// true</span> - </code> - </div> + <div class="php8-compare"> + <h2 class="php8-h2" id="saner-string-to-number-comparisons"> + <a class="php8-anchor" href="#saner-string-to-number-comparisons"></a> + 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 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"> - <code> - 0 == <span class="string">'foobar'</span> <span class="comment">// false</span> - </code> - </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> + + <div class="php8-compare"> + <h2 class="php8-h2" id="consistent-type-errors-for-internal-functions"> + <a class="php8-anchor" href="#consistent-type-errors-for-internal-functions"></a> + 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>\t\t strlen([]); // Warning: strlen() expects parameter 1 to be string, array given - <div class="php8-compare"> - <h2 class="php8-h2" id="consistent-type-errors-for-internal-functions"> - <a class="php8-anchor" href="#consistent-type-errors-for-internal-functions"></a> - 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"> - <code> - strlen([]); <span class="comment">// Warning: strlen() expects parameter 1 to be string, array given</span><br> - <br> - array_chunk([], -1); <span class="comment">// Warning: array_chunk(): Size parameter expected to be greater than 0</span> - </code> - </div> +array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be greater than 0</pre> </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"> - <code> - strlen([]); <span class="comment">// TypeError: strlen(): Argument #1 ($str) must be of type string, array given</span><br> - <br> - array_chunk([], -1); <span class="comment">// ValueError: array_chunk(): Argument #2 ($length) must be greater than 0</span> - </code> - </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> +</section> - <div class="php8-section php8-section_light"> - <h2 class="php8-h2">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> +<section class="php8-section php8-section_light"> + <h2 class="php8-h2">Just-In-Time compilation</h2> + <p> + PHP 8 introduces two JIT compilation engines. The more promising, tracing JIT shows about 3 times speed-up on + synthetic benchmarks and 1.5-2 times improvement on some specific long-running apps. Typical apps 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">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-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 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> - <div class="php8-section php8-section_dark php8-section_footer php8-footer center"> - <div class="php8-section__inner"> - <h2 class="php8-h2"> - 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 strictness. - </h2> - <div class="php8-button-wrapper"> - <a class="php8-button php8-button_light" href="#">Go update to PHP 8!</a> - </div> - <div class="php8-footer__content"> - <p> - For source downloads of PHP 8 please visit our <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 the detailed list of new features and backward-incompatible changes. - </p> - </div> +<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 strictness. + </h2> + <div class="php8-button-wrapper center"> + <a class="php8-button php8-button_light" href="#">Go update to PHP 8!</a> + </div> + <div class="php8-footer__content"> + <p> + For source downloads of PHP 8 please visit our <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 the detailed list of new features and backward-incompatible changes. + </p> </div> </div> -</div> +</section> diff --git a/styles/php8.css b/styles/php8.css index fc6ba4997..6a536eb5b 100644 --- a/styles/php8.css +++ b/styles/php8.css @@ -9,10 +9,6 @@ } } -.php8 { - vertical-align: middle; -} - .php8-section { padding: 96px 1.5rem; margin: 0 -1.5rem; @@ -23,8 +19,8 @@ color: #fff; } -.php8-section__inner { - width: 810px; +.php8-section__content { + width: 820px; max-width: 100%; margin: 0 auto; } @@ -48,6 +44,10 @@ font-family: Helvetica, Arial, sans-serif; } +.php8-section img { + max-width: 100%; +} + .php8-logo { vertical-align: middle; } @@ -121,11 +121,12 @@ } .php8-section_dark .php8-h2 { + display: block; color: #fff; } .php8-button-wrapper { - margin-top: 33px; + margin-top: 34px; } .php8-button { @@ -180,7 +181,7 @@ opacity: 0.85; } -.php8 p:last-child { +.php8-section p:last-child { margin-bottom: 0; } @@ -301,7 +302,7 @@ height: 36px; width: 20px; margin: auto; - background: url("/images/icon_arrow.svg") scroll no-repeat center center / contain transparent; + background: url("/images/php8/icon_arrow.svg") scroll no-repeat center center / contain transparent; } @media (max-width: 810px) { @@ -312,10 +313,6 @@ } } -.php8-section ul { - -} - .php8-section li ~ li { margin-top: 24px; } @@ -353,7 +350,7 @@ width: 30px; margin-top: 4px; margin-left: -30px; - background: url("/images/anchor.svg") scroll no-repeat left center / 21px 16px transparent; + background: url("/images/php8/anchor.svg") scroll no-repeat left center / 21px 16px transparent; text-decoration: none; border-bottom: none; }
-- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
