<?php
/**
* 2.2.1静态成员
* @authors haidong (admin@zhe700.net)
* @date 2015-03-23 13:46:19
* @version $Id$
*/
class MyObject {
public static $myStaticVar = 0;
function myMethod(){
self::$myStaticVar += 2;
echo self::$myStaticVar . "
";
}
}
$instance1 = new MyObject();
$instance1->myMethod();
$instance2 = new MyObject();
$instance2->myMethod();