Skip to content

Commit 522c2fa

Browse files
Add BCMath block to PHP 8.4 release page (#1142)
Co-authored-by: Saki Takamachi <[email protected]>
1 parent bd9daae commit 522c2fa

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

releases/8.4/languages/en.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
'deprecated_attribute_description' => 'The new <code>#[\Deprecated]</code> attribute makes PHP’s existing deprecation mechanism available to user-defined functions, methods, and class constants.',
1616
'dom_additions_html5_title' => 'New ext-dom features and HTML5 support',
1717
'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>',
18+
'bcmath_title' => 'Object API for BCMath',
19+
'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>',
1820
'new_array_find_title' => 'New <code>array_*()</code> functions',
1921
'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.',
2022
'pdo_driver_specific_parsers_title' => 'PDO Driver specific SQL parsers',

releases/8.4/release.inc

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,51 @@ PHP
334334
<?= message('dom_additions_html5_description', $lang) ?>
335335
</div>
336336
</div>
337+
<div class="php8-compare">
338+
<h2 class="php8-h2" id="bcmath">
339+
<?= message('bcmath_title', $lang) ?>
340+
<a class="php8-rfc" href="https://wiki.php.net/rfc/support_object_type_in_bcmath">RFC</a>
341+
</h2>
342+
<div class="php8-compare__main">
343+
<div class="php8-compare__block example-contents">
344+
<div class="php8-compare__label">PHP &lt; 8.4</div>
345+
<div class="php8-code phpcode">
346+
<?php highlight_php_trimmed(
347+
<<<'PHP'
348+
$num1 = '0.12345';
349+
$num2 = 2;
350+
$result = bcadd($num1, $num2, 5);
351+
352+
echo $result; // '2.12345'
353+
var_dump(bccomp($num1, $num2) > 0); // false
354+
PHP
355+
356+
); ?>
357+
</div>
358+
</div>
359+
<div class="php8-compare__arrow"></div>
360+
<div class="php8-compare__block example-contents">
361+
<div class="php8-compare__label php8-compare__label_new">PHP 8.4</div>
362+
<div class="php8-code phpcode">
363+
<?php highlight_php_trimmed(
364+
<<<'PHP'
365+
use BCMath\Number;
366+
367+
$num1 = new Number('0.12345');
368+
$num2 = new Number('2');
369+
$result = $num1 + $num2;
370+
371+
echo $result; // '2.12345'
372+
var_dump($num1 > $num2); // false
373+
PHP
374+
); ?>
375+
</div>
376+
</div>
377+
</div>
378+
<div class="php8-compare__content">
379+
<?= message('bcmath_description', $lang) ?>
380+
</div>
381+
</div>
337382
<div class="php8-compare">
338383
<h2 class="php8-h2" id="new_array_find">
339384
<?= message('new_array_find_title', $lang) ?>

0 commit comments

Comments
 (0)