如果这样呢
class   align 

        $s=array[1,2,3]; 
        function   a($b) 
        { 
            $this-> s[$b]; 
        } 
        function   b()
        {
            $out = $this->s[]."\r\n";
        }

这样也对吗?

解决方案 »

  1.   

    不行.
    另外第二行错了 array(1,2,3)
      

  2.   

    class  align 

            $s=array[]; 
            function  a($b) 
            { 
                $this-> s[$b]; 
            } 
            function  b() 
            { 
                $out = $this->s[]."\r\n"; 
            } 

    这样可以吗?
      

  3.   

    class  align 

            var $s=array(0,1,2,3);
            var $i=0;
            function  a($key,$value) 
            { 
                $this-> s[$key]=$value; 
            } 
            function  b($key) 
            { 
                echo  $this->s[$key]."\r\n"; 
            } 

    $test= new align ;
    $test->a(1,'a');
    $test->b(1);
      

  4.   

    绝对不行,楼上的syu讲的很清楚了。