Good day.
I use SprintF function in my localisation system for a custom script, but I would like to have also enum values which would spare me a lot of code.
Right now I do
$string = 'Some localisation string with %s and %s variables.';
$qwe = sprintf($string,'xxx', 'yyy'); //returns: Some localisation string with xxx and yyy variables.
It's good for simple values, but I have a lot of situations where I would like to use enumerable things.
So, I would like to have something like this
$string = 'Some string %{qwe,zxc,ddd,yyy} blah blah';
$qwe = someFunction($string,1); //would return: Some string zxc blah blah
$qwe = someFunction($string,3); //would return: Some string yyy blah blah
Is it possible? Is there any buildin function that can be used? Or do I have to implement it myself? If so, maybe there are already some solutions or libraries?
PS - please don't suggest me to use template engines. I only need this particular functionality.