Hi
Am 2025-05-25 12:07, schrieb Alwin Garside:
Finally, from a quick search in php-src there doesn't seem to be any
existing function name that starts with `num_`. For the sake of
consistency with the existing PHP functions, and similar functionality
in other languages, I suggest suffixing the function name with `_count`
instead.
So, to wrap this all up, I'd like to respectfully propose the following
function name instead:
cpu_core_count()
Naming is a good point indeed and one that I also hinted at with my
comment on the PR:
https://github.com/php/php-src/pull/11137#issuecomment-2888977523
I very strongly disagree with adding more “randomly named” functions to
ext/standard, the times of doing that are over. I would also claim that
it violates the “Coding Standards and Naming Policy”
(https://github.com/php/policies/blob/main/coding-standards-and-naming.rst)
in spirit.
At the very least the function should have a clear “prefix”. `sys` as in
`sys_getloadavg()` or `sys_get_temp_dir()` would probably work.
Alternatively `get` as in `getmyuid()` or `getrusage()` would also work.
As I've indicated in the PR, my preference would be creating a new
namespace and moving over the matching functions together with a
discussion of some namespace structure, including matching exceptions
(see https://wiki.php.net/rfc/extension_exceptions).
Best regards
Tim Düsterhus