Author: Sergey Panteleev (saundefined) Committer: GitHub (web-flow) Pusher: saundefined Date: 2025-11-19T19:58:42+03:00
Commit: https://github.com/php/web-php/commit/26d39a1fff9df2348139702be1015314647a5c59 Raw diff: https://github.com/php/web-php/commit/26d39a1fff9df2348139702be1015314647a5c59.diff PHP 8.5 release page updates (#1624) Changed paths: M releases/8.5/common.php M releases/8.5/release.inc M styles/php85.css Diff: diff --git a/releases/8.5/common.php b/releases/8.5/common.php index 0572de6319..2bad51cd69 100644 --- a/releases/8.5/common.php +++ b/releases/8.5/common.php @@ -25,8 +25,7 @@ function common_header(string $description): void { \site_header("PHP 8.5 Release Announcement", [ 'current' => 'php85', - 'css' => ['prism.css', 'php85.css'], - 'js_files' => ['js/ext/prism.js'], + 'css' => ['php85.css'], 'language_switcher' => $languages, 'theme_switcher' => true, 'meta_tags' => <<<META diff --git a/releases/8.5/release.inc b/releases/8.5/release.inc index 466d87609a..ee33e7769c 100644 --- a/releases/8.5/release.inc +++ b/releases/8.5/release.inc @@ -206,15 +206,21 @@ common_header(message('common_header', $lang)); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $components = parse_url('https://php.net/releases/8.4/en.php'); var_dump($components['host']); // string(7) "php.net" -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -224,17 +230,23 @@ var_dump($components['host']); <span class="badge-green"><?= message('badge_new', $lang) ?></span> <a target="_blank" href="https://wiki.php.net/rfc/url_parsing_api">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' use Uri\Rfc3986\Uri; $uri = new Uri('https://php.net/releases/8.5/en.php'); var_dump($uri->getHost()); // string(7) "php.net" -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -254,9 +266,15 @@ var_dump($uri->getHost()); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $title = ' PHP 8.5 Released '; $slug = strtolower( @@ -269,8 +287,8 @@ $slug = strtolower( var_dump($slug); // string(15) "php-85-released" -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -280,9 +298,15 @@ var_dump($slug); <span class="badge-green"><?= message('badge_new', $lang) ?></span> <a target="_blank" href="https://wiki.php.net/rfc/pipe-operator-v3">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $title = ' PHP 8.5 Released '; $slug = $title @@ -293,8 +317,8 @@ $slug = $title var_dump($slug); // string(15) "php-85-released" -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -314,9 +338,15 @@ var_dump($slug); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' readonly class Color { public function __construct( @@ -337,8 +367,8 @@ readonly class Color $blue = new Color(79, 91, 147); $transparentBlue = $blue->withAlpha(128); -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -348,9 +378,15 @@ $transparentBlue = $blue->withAlpha(128); <span class="badge-green"><?= message('badge_new', $lang) ?></span> <a target="_blank" href="https://wiki.php.net/rfc/clone_with_v2">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' readonly class Color { public function __construct( @@ -370,8 +406,8 @@ readonly class Color $blue = new Color(79, 91, 147); $transparentBlue = $blue->withAlpha(128); -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -391,17 +427,23 @@ $transparentBlue = $blue->withAlpha(128); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' function getPhpVersion(): string { return 'PHP 8.4'; } getPhpVersion(); // No warning -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -412,9 +454,15 @@ getPhpVersion(); // No warning <a target="_blank" href="https://wiki.php.net/rfc/marking_return_value_as_important">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' #[\NoDiscard] function getPhpVersion(): string { @@ -424,8 +472,8 @@ function getPhpVersion(): string getPhpVersion(); // Warning: The return value of function getPhpVersion() should // either be used or intentionally ignored by casting it as (void) -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -445,9 +493,15 @@ getPhpVersion(); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' final class PostsController { #[AccessControl( @@ -460,8 +514,8 @@ final class PostsController // ... } } -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -472,9 +526,15 @@ final class PostsController <a target="_blank" href="https://wiki.php.net/rfc/closures_in_const_expr">RFC <span>↗</span></a> <a target="_blank" href="https://wiki.php.net/rfc/fcc_in_const_expr">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' final class PostsController { #[AccessControl(static function ( @@ -490,8 +550,8 @@ final class PostsController // ... } } -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -511,9 +571,15 @@ final class PostsController <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $sh = curl_share_init(); curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); @@ -522,8 +588,8 @@ $ch = curl_init('https://php.net/'); curl_setopt($ch, CURLOPT_SHARE, $sh); curl_exec($ch); -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -535,9 +601,15 @@ curl_exec($ch); <a target="_blank" href="https://wiki.php.net/rfc/curl_share_persistence_improvement">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $sh = curl_share_init_persistent([ CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_CONNECT, @@ -548,8 +620,8 @@ curl_setopt($ch1, CURLOPT_SHARE, $sh); // This may now reuse the connection from an earlier SAPI request curl_exec($ch); -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -569,14 +641,20 @@ curl_exec($ch); <div> <span><?= message('old_version', $lang) ?></span> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $lastEvent = $events === [] ? null : $events[array_key_last($events)]; -</code> - </pre> +PHP + ); ?> </div> <div class="code-container"> @@ -586,12 +664,18 @@ $lastEvent = $events === [] <span class="badge-green"><?= message('badge_new', $lang) ?></span> <a target="_blank" href="https://wiki.php.net/rfc/array_first_last">RFC <span>↗</span></a> </div> + <button class="js-copy-code"> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"> + <path d="M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + <path d="M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> + </svg> + </button> </div> - <pre class="language-php"> -<code class="language-php"> + <?php highlight_php_trimmed( + <<<'PHP' $lastEvent = array_last($events); -</code> - </pre> +PHP + ); ?> </div> </div> </div> @@ -793,7 +877,27 @@ $lastEvent = array_last($events); </svg> <script> - Prism.highlightAll() + document.addEventListener('DOMContentLoaded', () => { + document.addEventListener('click', async (e) => { + const btn = e.target.closest('.js-copy-code'); + if (!btn?.closest('.code-container')) return; + + const code = btn.closest('.code-container').querySelector('code').textContent; + if (!navigator.clipboard) return console.error('Clipboard API not available'); + + try { + await navigator.clipboard.writeText(code); + const originalHTML = btn.innerHTML; + btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M5 14L8.5 17.5L19 6.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>'; + btn.disabled = true; + await new Promise(r => setTimeout(r, 2000)); + btn.innerHTML = originalHTML; + btn.disabled = false; + } catch (err) { + console.error('Copy failed:', err); + } + }); + }) </script> <?php diff --git a/styles/php85.css b/styles/php85.css index 07cecd7fcd..d8523e91aa 100644 --- a/styles/php85.css +++ b/styles/php85.css @@ -85,12 +85,17 @@ code[class*=language-], pre[class*=language-] { margin-left: -30px; height: 30px; width: 30px; - background: url("/images/php8/anchor-white.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; font-size: 0; } +.dark .features-title h2 .genanchor, +.dark .before-and-after-title-and-description h2 .genanchor { + background: url("/images/php8/anchor-white.svg") scroll no-repeat left center / 21px 16px transparent; +} + .features-title h2:hover .genanchor, .before-and-after-title-and-description h2:hover .genanchor { display: block; @@ -1127,7 +1132,7 @@ header nav { .hero-badge { margin-bottom: calc(var(--spacing) * 6); background-color: #ffffffa6; - border-radius: 3.40282e38px; + border-radius: calc(infinity * 1px); align-items: center; display: inline-flex } @@ -3540,99 +3545,54 @@ footer p:where(.dark,.dark *) { color: var(--color-gray-400) } -.html { - color: #abb2bf -} - -.constant, .property { - color: #0550ae -} - -.comment { - color: #6e7781; - font-style: italic -} - -.string { - color: #0a3069 -} - -.keyword { - color: #cf222e -} - -.literal { - color: #0550ae -} - -.type { - color: #953800 -} - -.variable, .number { - color: #0550ae +.php85 .phpcode { + padding: 1em; } -.function { - color: #8250df +.dark .php85 .phpcode::selection { + background-color: #333; } -.operator { - color: #cf222e +.php85 .phpcode span.comment { + color: #708090; + background-color: transparent; + font-style: italic; } -.punctuation { - color: #24292f +.php85 .phpcode span.default { + color: rgb(213, 51, 84); + background-color: transparent; } -.class { - color: #953800 +.php85 .phpcode span.keyword { + color: #07a; + background-color: transparent; } -.dark .constant, .dark .property { - color: #79c0ff +.php85 .phpcode span.string { + color: rgb(80, 119, 0); + background-color: transparent; } -.dark .comment { +.dark .php85 .phpcode span.comment { color: #8b949e; - font-style: italic -} - -.dark .default, -.dark .string { - color: #a5d6ff -} - -.dark .keyword { - color: #ff7b72 -} - -.dark .literal { - color: #79c0ff -} - -.dark .type { - color: #ffa657 -} - -.dark .variable, .dark .number { - color: #79c0ff -} - -.dark .function { - color: #d2a8ff + background-color: transparent; + font-style: italic; } -.dark .operator { - color: #ff7b72 +.dark .php85 .phpcode span.default { + color: #d2a8ff; + background-color: transparent; } -.dark .punctuation { - color: #c9d1d9 +.dark .php85 .phpcode span.keyword { + color: #ff7b72; + background-color: transparent; } -.dark .class { - color: #ffa657 +.dark .php85 .phpcode span.string { + color: #a5d6ff; + background-color: transparent; } .php85 #layout-content a.button-primary { @@ -3646,7 +3606,7 @@ footer p:where(.dark,.dark *) { font-weight: var(--font-weight-semibold); color: var(--color-white); background-color: #6b58ff; - border-radius: 3.40282e38px; + border-radius: calc(infinity * 1px); justify-content: center; align-items: center; text-decoration-line: none; @@ -3694,7 +3654,7 @@ footer p:where(.dark,.dark *) { --tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor); box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); --tw-ring-color: color-mix(in oklab, var(--color-gray-200) 50%, transparent); - border-radius: 3.40282e38px; + border-radius: calc(infinity * 1px); justify-content: center; align-items: center; text-decoration-line: none;
