私はフィルタヘルパーを作成しようとしていました。は、PHPで動作しません
<?php
$text ="hello world i am here !";
function findandreplace(&$text, $search, $replaced)
{
return str_replace($search, $replaced, $text);
}
print findandreplace($text,'e','E');
print "<br>";
print $text;
出力は、そのように常にある:
hEllo world i am hErE !
hello world i am here !
私は5月の事を試してみましたが、私は動作しませんので、私のせいとは何か。
なぜ$テキストを返す気に....しかし、 'str_replace()'それ自体は参照渡しではありません。変更された値 –
を返します。返り値を使用して試しましたが、私はそれを実行しませんでしたが、戻りませんでした。参照] –