Author: Roman Pronskiy (pronskiy) Committer: GitHub (web-flow) Pusher: saundefined Date: 2024-11-21T13:45:51+03:00
Commit: https://github.com/php/web-php/commit/522c2faf41da6be16e7541207762a949c34b0a91 Raw diff: https://github.com/php/web-php/commit/522c2faf41da6be16e7541207762a949c34b0a91.diff Add BCMath block to PHP 8.4 release page (#1142) Co-authored-by: Saki Takamachi <34942839+sakitakama...@users.noreply.github.com> Changed paths: M releases/8.4/languages/en.php M releases/8.4/release.inc Diff: diff --git a/releases/8.4/languages/en.php b/releases/8.4/languages/en.php index 0c0166aa3e..5052826c14 100644 --- a/releases/8.4/languages/en.php +++ b/releases/8.4/languages/en.php @@ -15,6 +15,8 @@ 'deprecated_attribute_description' => 'The new <code>#[\Deprecated]</code> attribute makes PHP’s existing deprecation mechanism available to user-defined functions, methods, and class constants.', 'dom_additions_html5_title' => 'New ext-dom features and HTML5 support', 'dom_additions_html5_description' => '<p>New DOM API that includes standards-compliant support for parsing HTML5 documents, fixes several long-standing compliance bugs in the behavior of the DOM functionality, and adds several functions to make working with documents more convenient.</p><p>The new DOM API is available within the <code>Dom</code> namespace. Documents using the new DOM API can be created using the <code>Dom\HTMLDocument</code> and <code>Dom\XMLDocument</code> classes.</p>', + 'bcmath_title' => 'Object API for BCMath', + 'bcmath_description' => '<p>BCMath allows you to work with arbitrary precision float numbers in PHP. With this release, you can benefit from object-oriented style and operator overloading to use BCMath numbers.</p><p>It means, you can now use standard operators with <code>BcMath\Number</code> objects, which also support all <code>bc*</code> functions.</p><p>These objects are immutable and implement the <code>Stringable</code> interface, so they can be used in string contexts like <code>echo $num</code>.</p>', 'new_array_find_title' => 'New <code>array_*()</code> functions', 'new_array_find_description' => 'New functions <a href="/manual/en/function.array-find.php"><code>array_find()</code></a>, <a href="/manual/en/function.array-find-key.php"><code>array_find_key()</code></a>, <a href="/manual/en/function.array-any.php"><code>array_any()</code></a>, and <a href="/manual/en/function.array-all.php"><code>array_all()</code></a> are available.', 'pdo_driver_specific_parsers_title' => 'PDO Driver specific SQL parsers', diff --git a/releases/8.4/release.inc b/releases/8.4/release.inc index cf41bc9f21..388f5e2cd8 100644 --- a/releases/8.4/release.inc +++ b/releases/8.4/release.inc @@ -334,6 +334,51 @@ PHP <?= message('dom_additions_html5_description', $lang) ?> </div> </div> + <div class="php8-compare"> + <h2 class="php8-h2" id="bcmath"> + <?= message('bcmath_title', $lang) ?> + <a class="php8-rfc" href="https://wiki.php.net/rfc/support_object_type_in_bcmath">RFC</a> + </h2> + <div class="php8-compare__main"> + <div class="php8-compare__block example-contents"> + <div class="php8-compare__label">PHP < 8.4</div> + <div class="php8-code phpcode"> + <?php highlight_php_trimmed( + <<<'PHP' +$num1 = '0.12345'; +$num2 = 2; +$result = bcadd($num1, $num2, 5); + +echo $result; // '2.12345' +var_dump(bccomp($num1, $num2) > 0); // false +PHP + + ); ?> + </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.4</div> + <div class="php8-code phpcode"> + <?php highlight_php_trimmed( + <<<'PHP' +use BCMath\Number; + +$num1 = new Number('0.12345'); +$num2 = new Number('2'); +$result = $num1 + $num2; + +echo $result; // '2.12345' +var_dump($num1 > $num2); // false +PHP + ); ?> + </div> + </div> + </div> + <div class="php8-compare__content"> + <?= message('bcmath_description', $lang) ?> + </div> + </div> <div class="php8-compare"> <h2 class="php8-h2" id="new_array_find"> <?= message('new_array_find_title', $lang) ?>