文字列に括弧が含まれていればspanで囲む

titleの中身の一部サイズを変えたい場合など。
<?php $targetText = $term_child->name; // ()が含まれていればspanで括る $search = array('(',')','(',')'); $replace = array('<span>(',')</span>','<span>(',')</span>'); $title = str_replace($search,$replace,$targetText); ?>
-
前の記事
phpでカウント値を設定して回数を指定する方法 2016.10.19
-
次の記事
リストのマークを任意のテキスト(記号)に変更する 2016.10.19