# Deprecate b-prefix for strings

- Thread: https://externals.io/message/132634
- Original archive: https://news-web.php.net/php.internals/132634
- Started by Juliette Reinders Folmer on 2026-09-25T11:32:17+00:00
- Messages: 7
- RFC: Deprecations for PHP 8.7 (Draft) — https://externals.io/rfc/deprecations_php_8_7.md
- RFC: Deprecations for PHP 8.5 (Implemented (PHP 8.5)) — https://externals.io/rfc/deprecations_php_8_5.md
- RFC: Binary String Deprecation (Declined) — https://externals.io/rfc/binary_string_deprecation.md
- 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

---

## #132634 — Juliette Reinders Folmer — 2026-09-25T11:32:17+00:00

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

All,

The `b` string prefix and the `(binary)` cast were both introduced in 
PHP 5.2.1 for forward compatibility with PHP 6.

In 2016, there was an RFC [1] targeting PHP 7.x to deprecate both, which 
was declined.

Since then, the `(binary)` type cast has now been deprecated in PHP 
8.5.0 [2], but as far as I can see, the `b`-prefix for strings is still 
supported.

I can't remember ever coming across this in the wild, so I wonder if it 
might be a good idea to deprecate the `b`-prefix now as well.

I'll happily create an RFC for this if the you all think it's a good idea.

Opinions ?

Smile,
Juliette


1: https://wiki.php.net/rfc/binary_string_deprecation
2: 
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names

---

## #132635 — tim@bastelstu.be — 2026-09-25T11:35:59+00:00

URL: https://externals.io/message/132634#132635 · In reply to: #132634

Hi


> I'll happily create an RFC for this if the you all think it's a good 
> idea.

I do. You can probably just add an entry to PHP 8.7's bulk RFC: 
https://wiki.php.net/rfc/deprecations_php_8_7

Best regards
Tim Düsterhus

---

## #132800 — Juliette Reinders Folmer — 2026-10-05T21:22:44+00:00

URL: https://externals.io/message/132634#132800 · In reply to: #132634

> All,
>
> The `b` string prefix and the `(binary)` cast were both introduced in 
> PHP 5.2.1 for forward compatibility with PHP 6.
>
> In 2016, there was an RFC [1] targeting PHP 7.x to deprecate both, 
> which was declined.
>
> Since then, the `(binary)` type cast has now been deprecated in PHP 
> 8.5.0 [2], but as far as I can see, the `b`-prefix for strings is 
> still supported.
>
> I can't remember ever coming across this in the wild, so I wonder if 
> it might be a good idea to deprecate the `b`-prefix now as well.
>
> I'll happily create an RFC for this if the you all think it's a good idea.
>
> Opinions ?
>
> Smile,
> Juliette
>
>
> 1: https://wiki.php.net/rfc/binary_string_deprecation
> 2: 
> https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names

Just in case you missed it in the avalanche of proposals being discussed 
on the list at this moment.

So far, this suggestion has had one response, which is not enough to 
make it worth the effort for me to write an RFC and find someone to 
collaborate with for the C-code.

Unless there are more people who respond to indicate interest in this 
proposal, I will not pursue it.

Smile,
Juliette

---

## #132801 — Daniel Scherzer — 2026-10-05T21:44:07+00:00

URL: https://externals.io/message/132634#132801 · In reply to: #132800

Hi Juliette,

I'm happy to work on the C code, and have added this as an entry to the 8.7
deprecations RFC at
https://wiki.php.net/rfc/deprecations_php_8_7#deprecate_the_b_prefix_for_binary_strings.
If you have edit access and want to add the reasoning, please feel free - I
didn't copy from your original message because the wiki is licensed under
the "CC Attribution-Noncommercial-Share Alike 4.0 International" license
and I can't agree to that for text that I didn't write. If you can't or
don't want to update the RFC page, I'll expand on the reasoning at some
point between now and when that RFC is officially under discussion next
year.

-Daniel

On Mon, Oct 5, 2026 at 2:39 PM Juliette Reinders Folmer <
php-internals_nospam@adviesenzo.nl> wrote:

> 
>
> All,
>
> The `b` string prefix and the `(binary)` cast were both introduced in PHP
> 5.2.1 for forward compatibility with PHP 6.
>
> In 2016, there was an RFC [1] targeting PHP 7.x to deprecate both, which
> was declined.
>
> Since then, the `(binary)` type cast has now been deprecated in PHP 8.5.0
> [2], but as far as I can see, the `b`-prefix for strings is still supported.
>
> I can't remember ever coming across this in the wild, so I wonder if it
> might be a good idea to deprecate the `b`-prefix now as well.
>
> I'll happily create an RFC for this if the you all think it's a good idea.
>
> Opinions ?
>
> Smile,
> Juliette
>
>
> 1: https://wiki.php.net/rfc/binary_string_deprecation
> 2:
> https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names
>
>
> Just in case you missed it in the avalanche of proposals being discussed
> on the list at this moment.
>
> So far, this suggestion has had one response, which is not enough to make
> it worth the effort for me to write an RFC and find someone to collaborate
> with for the C-code.
>
> Unless there are more people who respond to indicate interest in this
> proposal, I will not pursue it.
>
> Smile,
> Juliette

---

## #132802 — Sjoerd Langkemper — 2026-10-06T08:04:49+00:00

URL: https://externals.io/message/132634#132802 · In reply to: #132634

> I wonder if it might be a good idea to deprecate the `b`-prefix now as well.

Previous discussion threads on this:

https://news-web.php.net/php.internals/98131
https://news-web.php.net/php.internals/96743
https://news-web.php.net/php.internals/97881

I don't really have a strong opinion on this. It seems nobody uses this anymore, but there also does not seem a big advantage to removing it.

Regards,

Sjoerd

---

## #132814 — Larry Garfield — 2026-10-06T16:00:36+00:00

URL: https://externals.io/message/132634#132814 · In reply to: #132802

> 
> > […]
>
> Previous discussion threads on this:
>
> https://news-web.php.net/php.internals/98131
> https://news-web.php.net/php.internals/96743
> https://news-web.php.net/php.internals/97881
>
> I don't really have a strong opinion on this. It seems nobody uses this 
> anymore, but there also does not seem a big advantage to removing it.
>
> Regards,
>
> Sjoerd

Likewise, I'd probably vote in favor if it came up, but it's not something I am likely to put many other brain cells on.

--Larry Garfield

---

## #132858 — Juliette Reinders Folmer — 2026-10-09T22:21:42+00:00

URL: https://externals.io/message/132634#132858 · In reply to: #132800

> 
> > […]
>
> Just in case you missed it in the avalanche of proposals being 
> discussed on the list at this moment.
>
> So far, this suggestion has had one response, which is not enough to 
> make it worth the effort for me to write an RFC and find someone to 
> collaborate with for the C-code.
>
> Unless there are more people who respond to indicate interest in this 
> proposal, I will not pursue it.
>
> Smile,
> Juliette
>

Thanks to the people who have responded and to Daniel for offering to 
handle the C-code changes. I will write up the proposal properly and do 
an impact analysis and will add this to the PHP 8.7 bulk deprecations 
RFC in the near future.

Have a good weekend!

Smile,
Juliette
