The implication of only being used as a debugging tool is that it should never hit production code.
This is contradicted by the line above ("but are optimised away to have zero cost in production") above and the paragraph following it which requires asserts to exist in running code to make sense.
As mentioned in a comment on the php.net page (https://www.php.net/manual/en/function.assert.php#129271), `assert` sees widespread usage in code in the wild. It definitely is used outside of debugging.
Instead of removing it, this changes the line to mention its relation to debugging which is relevant and otherwise absent from the article.
* Add links to INI_* constants
Replace XInclude'd variablelist with a duplicate which does not have any IDs for the constants.
Add IDs to the variablelist on the constant page.
* Add comment with xi:include
---------
Co-authored-by: haszi <haszika80@gmail.com>
* ini-get.xml: add the literal tag to the pdo.dsn.* family of options
* ini-get-all.xml: add the literal tag
* ini-get.xml: modify the code example and the output
* Update ini-get.xml: fix the size in bytes
* ini-get.xml: fix converting k, m, g into bytes
We could use merely this insted the `return_bytes` fn:
```
<?php
/*
Our php.ini contains the following settings:
display_errors = On
register_globals = Off
post_max_size = 8M
*/
echo 'display_errors = ' . ini_get('display_errors') . "\n";
echo 'register_globals = ' . (int) ini_get('register_globals') . "\n";
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
echo 'post_max_size + 1 = ' . (rtrim(ini_get('post_max_size'), 'KMG') + 1) . "\n";
echo 'post_max_size in bytes = ' . ini_parse_quantity(ini_get('post_max_size'));
```
The reference itself says that this is not recommended and `assert_options()`
itself is deprecated in PHP 8.3. Remove the reference to slim down the docs.
`assert()` behaves like a regular function for all intents and purposes. It can
even be used as a string callable. The only special thing about is that the
`$description`'s default parameter is dynamic.
- Drop the assert.exception=0 case, because that is deprecated.
- Showcase the output for enabled assertions first.
- Add example with a custom message
They are no longer supported as of PHP 8 and only serve to cause confusion for a
feature that is already complex enough by itself.
In fact the examples will silently misbehave in PHP 8, because a non-empty
string is truthy and no warning is emitted.
The handling of the 3rd parameter for assert callbacks set via `assert_options`
changed with the implementation of the expectations RFC, and changed again in
PHP 8. Update the documentation accordingly.
This one seems to be a cause for confusion; witness Bug [#79602]
(https://bugs.php.net/bug.php?id=79602).
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Closes GH-120.