zoukankan      html  css  js  c++  java
  • & 引用传值

        public function ko(){
    
            $arr_1 = [
                ['name' => 'zhang0','sex' =>   0],
                ['name' => 'zhang1','sex' =>   1],
                ['name' => 'zhang2','sex' =>   0],
                ['name' => 'zhang3','sex' =>   1],
                ['name' => 'zhang4','sex' =>   0]
            ];
    
            $arr_2 = [
                ['name' => 'li0','sex' =>   0],
                ['name' => 'li1','sex' =>   1],
                ['name' => 'li2','sex' =>   0],
                ['name' => 'li4','sex' =>   0]
            ];
    
            foreach ($arr_1 as &$v){
                $v['sex_str'] = '';
            }
    
            $result = $arr_1;
            foreach ($arr_2 as $v){
                $v['sex_str'] = '';
            }
    
            dump($arr_1);
            dump($arr_2);
            dump($result);
            exit;
        }


    <pre>array(5) {
    [0] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang0&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [1] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang1&quot;
    [&quot;sex&quot;] =&gt; int(1)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [2] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang2&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [3] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang3&quot;
    [&quot;sex&quot;] =&gt; int(1)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [4] =&gt; &amp;array(3) {
    [&quot;name&quot;] =&gt; string(3) &quot;li4&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;女&quot;
    }
    }
    </pre><pre>array(4) {
    [0] =&gt; array(2) {
    [&quot;name&quot;] =&gt; string(3) &quot;li0&quot;
    [&quot;sex&quot;] =&gt; int(0)
    }
    [1] =&gt; array(2) {
    [&quot;name&quot;] =&gt; string(3) &quot;li1&quot;
    [&quot;sex&quot;] =&gt; int(1)
    }
    [2] =&gt; array(2) {
    [&quot;name&quot;] =&gt; string(3) &quot;li2&quot;
    [&quot;sex&quot;] =&gt; int(0)
    }
    [3] =&gt; array(2) {
    [&quot;name&quot;] =&gt; string(3) &quot;li4&quot;
    [&quot;sex&quot;] =&gt; int(0)
    }
    }
    </pre><pre>array(5) {
    [0] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang0&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [1] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang1&quot;
    [&quot;sex&quot;] =&gt; int(1)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [2] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang2&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [3] =&gt; array(3) {
    [&quot;name&quot;] =&gt; string(6) &quot;zhang3&quot;
    [&quot;sex&quot;] =&gt; int(1)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;男&quot;
    }
    [4] =&gt; &amp;array(3) {
    [&quot;name&quot;] =&gt; string(3) &quot;li4&quot;
    [&quot;sex&quot;] =&gt; int(0)
    [&quot;sex_str&quot;] =&gt; string(3) &quot;女&quot;
    }
    }
    </pre>

     
  • 相关阅读:
    Leetcode 283. Move Zeroes
    利用脚本,一键设置java环境变量(默认安装路径)
    'wmic' 不是内部或外部命令,也不是可运行的程序 解决方法
    PowerShell因为在此系统中禁止执行脚本解决方法
    使用VBSCRIPT安装字体
    批处理基本知识以及进阶 V2.0
    Vbs 脚本编程简明教程之一
    用批处理,批量安装字体文件 (Erector.bat)
    windows 7 系统装机优化
    使用批处理替换windows系统中的hosts文件
  • 原文地址:https://www.cnblogs.com/pansidong/p/10752757.html
Copyright © 2011-2022 走看看