http_build_query() supports enumerations¶
http_build_query() accepted backed enumerations, and used to produce a query string with a b
array, containing value
and name
. Since PHP 8.4, it is now using the string value of the case.
PHP code¶
<?php
enum E : string {
case B = 'b';
}
print http_build_query(['a' => 'A', 'b' => e::B]);
Before¶
a=A&b%5Bname%5D=B&b%5Bvalue%5D=b
After¶
a=A&b=b
PHP version change¶
This behavior changed in 8.4