# PHP 7 API naming conventions: str vs string

- Thread: https://externals.io/message/80832
- Original archive: https://news-web.php.net/php.internals/80832
- Started by francois@tekwire.net on 2015-01-19T15:57:19+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

---

## #80832 — francois@tekwire.net — 2015-01-19T15:57:19+00:00

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

Hi,



> 
> > […]
the
> > […]
> I personally prefer cstr/zstr for explicitness, but agree that the
> main focus should be consistency.
>

Do you mean Z_STRVAL would become Z_CSTRVAL ? Argh...

I would suggest that references to zstrings should always be prefixed with a
'z', no matter if it is 'zstr' or 'zstring'. This way, when you see 'str' or
'string' in a name, you know it cannot be a zend string. The only exception
would be the 'zend_string' type itself but even 'zend_string' in function
names should be replaced because you cannot know if the 'zend_' substring is
just part of the function name or refers to the 'zend_string' type.

Making a difference between 'str' and 'string' is too cryptic and not
intuitive. And what about a new future string type ? Use 'st' or 'stri' :) ?

ZVAL_STR would become ZVAL_ZSTR, for instance. Some may find it redundant
but the 'Z' of ZVAL and the the one of 'ZSTR' have nothing in common.

cstr/cstring would be fine for a new project but the BC break is terrible.
Even for new functions/macros, I would keep str/string for C strings because
consistency is the most important.

Cheers

François
