zoukankan      html  css  js  c++  java
  • The right method that PHP reference variables be used in function

    The error echo:

    Only variables should be assigned by reference in.

    <?php
    /**
     * Created by IntelliJ IDEA.
     * User: houzhibin
     * Date: 2019/12/4
     * Time: 08:57
     */
    
    function build_row(&$text){
        $text="<tr><td>$text</td></tr>";
        //return $text;
    }
    
    $t="测试速度";
    build_row($t);
    echo '<table border="1">';
    echo $t;
    echo $t;
    echo $t;
    echo '</table>';
    

      the error wirte method:

    <?php
    /**
     * Created by IntelliJ IDEA.
     * User: houzhibin
     * Date: 2019/12/4
     * Time: 08:57
     */
    
    function build_row(&$text){
        $text="<tr><td>$text</td></tr>";
        //return $text;
    }
    
    $t="测试速度";
    $row=&build_row($t);
    echo '<table border="1">';
    echo $t;
    echo $t;
    echo $t;
    echo '</table>';
    

      The fifty row is error that '&' was usd in there ;

    /Applications/XAMPP/xamppfiles/bin/php -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9001 -dxdebug.remote_host=127.0.0.1 /Users/houzhibin/javaself/code/php/shop/crmeb3/public/install/test/imp1.php
    PHP Notice:  Only variables should be assigned by reference in /Users/houzhibin/javaself/code/php/shop/crmeb3/public/install/test/imp1.php on line 15
    
    PHP Stack trace:
    Notice: Only variables should be assigned by reference in /Users/houzhibin/javaself/code/php/shop/crmeb3/public/install/test/imp1.php on line 15
    PHP   1. {main}() /Users/houzhibin/javaself/code/php/shop/crmeb3/public/install/test/imp1.php:0
    
    Call Stack:
        0.1099     354648   1. {main}() /Users/houzhibin/javaself/code/php/shop/crmeb3/public/install/test/imp1.php:0
    
    <table border="1"><tr><td>测试速度</td></tr><tr><td>测试速度</td></tr><tr><td>测试速度</td></tr></table>
    Process finished with exit code 0
    www.beicaiduo.com
  • 相关阅读:
    VisionPro 极坐标圆形物体缺陷检测
    VisionPro CogSobeEdgeTool工具
    VisionPro CogLinescanDistortionCorrectionTool工具 图像处理工具
    VisionPro CogIPTwoImageSubtractTool工具 图像处理工具
    云原生技术实践-关键要素和原则
    深度解析项目管理
    商业进化图谱
    一张图理解网络的几个专有名词:数据、段、包、帧、比特
    泛在感知中台建设方案
    区块链生态架构图
  • 原文地址:https://www.cnblogs.com/hoge66/p/11980873.html
Copyright © 2011-2022 走看看