function后加一个&表示这个函数返回类型是一个资源句柄
是一个指针类型

解决方案 »

  1.   

    一般的函数的参数都是通过值来输入的。用&是指用地址的方式,传入参数的指针。
    最简单的
    <?php
    function fun(&$str){
       $str="-".$str."-";//左右两个$str,无return
    }
    $a="xy";
    fun($a);
    echo $a;
      

  2.   

    这些php语法上的问题到哪里去查了,php.net的在线手册查不到阿
      

  3.   

    有时,在没有声明任何实例的情况下访问类中的函数或者基类中的函数和变量很有用处。 而 :: 操作符即用于此情况。 
    class A
    {
        function example()
        {
            echo "I am the original function A::example().<br>\n";
        }
    }class B extends A
    {
        function example()
        {
            echo "I am the redefined function B::example().<br>\n";
            A::example();
        }
    }// there is no object of class A.
    // this will print
    //   I am the original function A::example().<br>
    A::example();// create an object of class B.
    $b = new B;// this will print 
    //   I am the redefined function B::example().<br>
    //   I am the original function A::example().<br>
    $b->example();
     
    上面的例子调用了 A 类的函数 example(),但是这里并不存在 A 类的对象, 因此不能这样用 $a->example() 或者类似的方法调用 example()。反而我们 将 example() 作为一个类函数来调用,也就是说,作为一个类自身的函数来调用 ,而不是这个类的任何对象。 这里有类函数,但没有类的变量。实际上,在调用函数时完全没有任何对象。因而 一个类的函数可以不使用任何对象(但可以使用局部或者全局变量),并且可以根本 不使用 $this 变量。 function后加一个&表示这个函数返回类型是一个资源句柄
    是一个指针类型