次の変数があります。
$argument = 'blue widget';
次の関数で渡します。
widgets($argument);
widgets 関数には 2 つの変数があります。
$price = '5';
$demand ='low';
私の質問は、次のことをどのように行うことができるかです。
$argument = 'blue widget'.$price.' a bunch of other text';
widgets($argument);
//now have function output argument with the $price variable inserted where I wanted.
- 関数に $price を渡したくない
- 価格は関数内で利用可能になります
これを行う適切な方法はありますか、それともデザインを再考する必要がありますか?