Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BCMath block to PHP 8.4 release page #1142

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions releases/8.4/languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
45 changes: 45 additions & 0 deletions releases/8.4/release.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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 &lt; 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) ?>
Expand Down