preg_match_6.php
2016-05-08 18:09
1441 查看
实例 3-32 美元符“$”和插入符“^”的联合使用
本实例演示美元符和插入符的联合使用,如代码3-32 所示。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> preg_match_6.php </title>
<meta charset="UTF-8">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<?php
$pattern="/^PHP$/";
$str="PHP";
if (preg_match($pattern,$str))
print("发现匹配!<br>");
else
print("没发现匹配!<br>");
$str=" PHP is the best scripting language";
if (preg_match($pattern,$str))
print("发现匹配!<br>");
else
print("没发现匹配!<br>");
?>
</body>
</html>
发现匹配!
没发现匹配!
本实例演示美元符和插入符的联合使用,如代码3-32 所示。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> preg_match_6.php </title>
<meta charset="UTF-8">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<?php
$pattern="/^PHP$/";
$str="PHP";
if (preg_match($pattern,$str))
print("发现匹配!<br>");
else
print("没发现匹配!<br>");
$str=" PHP is the best scripting language";
if (preg_match($pattern,$str))
print("发现匹配!<br>");
else
print("没发现匹配!<br>");
?>
</body>
</html>
发现匹配!
没发现匹配!
相关文章推荐
- yii2 左侧菜单子级无法高亮的问题
- yii2 左侧菜单子级无法高亮的问题
- preg_match_2.php
- strpos.php
- strrpos.php
- substr_replace.php
- str_ireplace.php
- php 正则表达式
- php strtotime 和 date 日期操作
- php面向对象编程self和static的区别
- php7安装后无法开机启动问题
- PHP基本内置函数
- PHP 根据IP地址获取所在城市
- Laravel与CI框架中截取字符串函数
- ThinkPHP创建web项目
- thinkphp新增一个模块
- 在wamp环境中进入phpMyAdmin的报错处理方法
- php常用函数-数学
- php常用函数-数组
- Thinkphp单字母函数使用指南