# [RFC] Exposed parsed value of php.ini numeric directives

- Thread: https://externals.io/message/117709
- Original archive: https://news-web.php.net/php.internals/117709
- Started by Dennis Snell on 2022-05-10T01:20:02+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #117709 — Dennis Snell — 2022-05-10T01:20:02+00:00

URL: https://externals.io/message/117709#117709

> `ini_get_size($option)` would be nice to have, but may not be feasible,
see <https://github.com/php/php-src/pull/8380#issuecomment-1100226598
>.


I concur and did start by exploring this idea. It raised too many questions when a simpler interface seemed
to accomplish what we need in practice.


> I guess it could [have ]be[en] useful to Symfony too:


It's my presumption that many projects have had to build some workaround, most of which are defective in a
range of plausible values (such as the linked Symphony code that interprets a `t` when PHP doesn't). Adding
this scope-limited function could be dramatic in removing the need to port PHP internals to outside projects.


> Regarding the name: What about 'ini_get_as_bytes()'? It makes the 
relationship with 'ini_get()' clear by using the same prefix and the 
suffix should be reasonable explanatory in what happens.

> Just not sure whether it should be e.g. `ini_get_size($option)` (like
ini_get) or rather e.g. `ini_parse_size($value)` (more generally
usable).


Given that many non-memory-size configuration settings also currently use this same parsing flow I have been
mixed on associating this with "byte sizes" the way the PHP docs indicate. In fact, based on the work in #7951
I've renamed my proposed function to `ini_parse_quantity( $shorthand )` and rather like the match between
the implementation and meaning.



---


Dennis Snell
