I think one potential improvement for PHP is to make PHP templating usable again. This is something that could have a low cost of implementation but a big win.
Example on improvements
1) auto-escape output - one of the biggest reason not to use PHP for templating is that you need to manually escape your strings to avoid XSS, whereas a dedicated templating library can do this for you. This could be done with a either a special opening and closing tag or let you register a tag hook.
2) today you can use the alternative syntax for if, while, for, foreach, and switch
This could be expanded for match expression, closures, and other block expressions.
3) custom HTML tag support, register a HTML tag like <my-form> and implement it thru an API, perhaps a class that implements an interface. And now you can do much better reusable components that can automatically close them selves instead of multiple calls.
In the first example you need to always match one function call with another function call ( manual work), in the latter example you HTML just needs to be valid, which many editors can detect for you.
And it would be easy to share these custom components on github with composer.
Example on improvements
1) auto-escape output - one of the biggest reason not to use PHP for templating is that you need to manually escape your strings to avoid XSS, whereas a dedicated templating library can do this for you. This could be done with a either a special opening and closing tag or let you register a tag hook.
2) today you can use the alternative syntax for if, while, for, foreach, and switch
https://www.php.net/manual/en/control-structures.alternative...
This could be expanded for match expression, closures, and other block expressions.
3) custom HTML tag support, register a HTML tag like <my-form> and implement it thru an API, perhaps a class that implements an interface. And now you can do much better reusable components that can automatically close them selves instead of multiple calls.
e.g instead of
you can do In the first example you need to always match one function call with another function call ( manual work), in the latter example you HTML just needs to be valid, which many editors can detect for you.And it would be easy to share these custom components on github with composer.