1.php5之后的版本已经支持
2.没什么区别,区别在于php4的类没有析构(__destruct)函数,构造只能用类名作构造函数名
3.? function __destruct()

解决方案 »

  1.   

    php5中可以使用private,protect,public等关键字,默认为public
    没区别,__construct和__destruct是php5特有的,且也支持类名做为构造函数名。php4只能使用类名作为函数名
    __destruct()
      

  2.   

    1、PHP中是否可以使用私有成员、私有方法。 <?php
    class test
    {
    private $name;
    private function getName(){}
    }
    ?>
    2、PHP中使用类名作为函数名的构造函数和使用__construct作为函数名的构造函数有什么区别? 
    #Php4
    <?php
    class Auto_Cart extends Cart {
        function Auto_Cart() {
            $this->add_item ("10", 1);
        }
    }
    ?>
    #Php5 Auto_Cart __construct 都可以
    3、析构函数有哪几种函数名称。<?php
    class MyDestructableClass {
       function __construct() {
           print "In constructor\n";
           $this->name = "MyDestructableClass";
       }   function __destruct() {
           print "Destroying " . $this->name . "\n";
       }
    }$obj = new MyDestructableClass();
    ?> 
    #Php5中引入的,只有这一个函数名.
      

  3.   

    建议php5使用__construct,因为肯定要先搜索这个,搜不到才去找与类名相同的构造函数。