スニペット
$text = preg_replace_callback('hogehoge', "hoge", $text);
function hogege($matches) {
$num = preg_replace("/[^0-9]/ius", "", "$matches[2]");
return $matches[1] . 'width="' . $num . '"' . $matches[3];
}
正規表現に処理を挟む事が出来る。よく使うのに良く忘れる。
$text = preg_replace_callback('hogehoge', "hoge", $text);
function hogege($matches) {
$num = preg_replace("/[^0-9]/ius", "", "$matches[2]");
return $matches[1] . 'width="' . $num . '"' . $matches[3];
}
正規表現に処理を挟む事が出来る。よく使うのに良く忘れる。