Hi, > A large part of that is because the placeholders are positional rather > > than named, so you have to keep track of which is which; but by the time > > you've got named placeholders, you might as well have variable > > interpolation. > > I feel the same way. PHPStorm has a feature that highlights the given > expression when your cursor is placed on a %s placeholder and vice > versa. This seems to be the treatment of that symptom. >
Has "add named placeholders to *printf()" been proposed/discussed before (I didn't find)? What about strtr() (e.g. `strtr('The {foo} is {bar}.', ['{foo}' => FOO, '{bar}' => bar()])`)? (and even templating engines like Twig?) Anyway, it sometimes baffles me indeed that I can build a string with a method call like `"...{$foo->bar()}..."` but not with a function call like `"...{foo($bar)}..."`, and also with complex interpolation via callable variable like `"...{$foo($bar + baz($qux))}..."` but not with simple constant like `"...{FOO}..."` or operation like `"...{$foo + 1}..."` :/ Regards, -- Guilliam Xavier