$b = "как вывести: ". $a ."?"; function test($a) { global $b; echo "Подскажите, $b"; } test("test"); // Подскажите, как вывести: ? $b = " вывести: "; $c = " только так?"; function test2($a) { global $b, $c; echo "Или можно, ". $b . $a . $c; } test2("test"); // Или можно, вывести: test только так? - I did not understand what you want - Alexey Shimansky
- @ Alexey Shimansky, I thought with an example you will understand, if I look at the first function, I would like to display "Tell me how to output: test?" - wwwplaton
|
1 answer
You can use the function str_replace
$pattern = "как вывести: {placeholder}?"; function test($a) { global $pattern; echo "Подскажите, ".str_replace("{placeholder}",$a, $pattern); } test("test"); // Подскажите, как вывести: test? - Brilliant! Thank you, I would not think of it :) - wwwplaton
|