php preg 函数使用示例
php preg 函数使用示例 [代码片段(15行)]
<?php
if (preg_match('{<title>.+</title>}', $html)) {
// page has a title
}
if (preg_match_all('/<li>/', $html, $matches)) {
print 'Page has ' . count($matches[0]) . ' list items\n';
}
// turn bold into italic
$italics = preg_replace('/(<\/?)b(>)/', '$1i$2', $bold);
?>
- 上一篇:php输出数组的最大值和最小值
- 下一篇:php转换文件大小为易于阅读的格式
精彩图集
精彩文章






