简单说说,如有出入大家指正。->一般用于类的实例对数据成员和成员函数的引用和调用(如过不明白,去看写OPP的资料吧)
=>一般用于数组内,建立索引于对应值的关系。下面是个很简单的判断和函数,帖个函数介绍,字节琢磨吧:
stristr
(PHP 3>= 3.0.6, PHP 4 )stristr -- Case-insensitive strstr()
Description
string stristr ( string haystack, string needle)
Returns all of haystack from the first occurrence of needle to the end. needle and haystack are examined in a case-insensitive manner. If needle is not found, returns FALSE. If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
=>一般用于数组内,建立索引于对应值的关系。下面是个很简单的判断和函数,帖个函数介绍,字节琢磨吧:
stristr
(PHP 3>= 3.0.6, PHP 4 )stristr -- Case-insensitive strstr()
Description
string stristr ( string haystack, string needle)
Returns all of haystack from the first occurrence of needle to the end. needle and haystack are examined in a case-insensitive manner. If needle is not found, returns FALSE. If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
具体什么意思?
$mal_header :一个类实例;
subject :类的属性;
-> :用于访问类的属性;<?php
// 程序名: cart.inc
class Cart {
var $items; // 手推车类
// 本方法加入 $num 件物品到手推车中 (加到 $artnr 变量)
function add_item ($artnr, $num) {
$this->items[$artnr] += $num;
}
// 本方法从手推车减少 $num 件物品 (从 $artnr 变量减掉)
function remove_item ($artnr, $num) {
if ($this->items[$artnr] > $num) {
$this->items[$artnr] -= $num;
return true;
} else {
return false;
}
}
}class Named_Cart extends Cart {
var $owner;
function set_owner ($name) {
$this->owner = $name;
}
}
$ncart = new Named_Cart; // 建立类变量
$ncart->set_owner ("CyberRidder"); // 配置类的记名属性
echo $ncart->owner; // 显示类的记名属性
$ncart->add_item ("10", 1); // 从父类遗传的方法也可使用
?>=> :为数组原素赋值;$fruits = array(
"fruits" => array("a"=>"orange","b"=>"banana","c"=>"apple"),
"numbers" => array(1, 2, 3, 4, 5, 6),
"holes" => array("first", 5 => "second", "third")
);
用于在$nianli中查找 "=?gb2312?B?" ;
没有时return FALSE;
类似有 strchr(), strrchr(), substr(), and ereg().