Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
string1を入力として受け取り、2つのパラメーターの間にあるテキストをすべて取得し、取得した文字列を操作して、すべてを返す関数を作成したいと思います。
たとえば、私がこれを持っているとしましょう:[こんにちは]私の名前[は]ジョンです。
私はこれが欲しい:
<a href='Hi'>Hi</a> my name <a href='is'>is</a> John.
preg_replace('/\[(.*?)\]/', '<a href="$1">$1</a>', $str);