in C# .NET we have a function like below
String.format("abc{0}", " some text");
It will output final string like below.
abc some text
Is there is String.Format
method in Laravel 5?
Reason I asked this because I have below keys in .env file
UserFolder = public\User
and i want to add one more key below. SO in order to hardcode the images in code files, I want to do it in .env
UserFolder = public\User\{0}\images
Here {0}
will be replaced with UserID
PHP has the built-in function sprintf which should have similar results.
In your example, usage would be:
The .env file: UserFolder = public\User\%s\images
Usage in php: $folder = sprintf(env('UserFolder'), 'your user id here');