class="area">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>應用strncmp()函數比較字符串的前2個字符是否與源字符串相等</title>
</head>
<body>
<?php
$str1="I like PHP !"; //定義字符串常量
$str2="i am fine !"; //定義字符串常量
echo strncmp($str1,$str2,2); //比較前2個字符
?>
</body>
</html>