hopestar86
V2EX  ›  PHP

求教php类 function里参数前面的&符有啥作用?

  •  
  •   hopestar86 · Sep 27, 2012 · 4142 views
    This topic created in 5028 days ago, the information mentioned may be changed or developed.

    class splitPageResults {
    function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) {
    .....

    }
    4 replies    1970-01-01 08:00:00 +08:00
    xlmo
        1
    xlmo  
       Sep 27, 2012
    按引用传递。
    qiayue
        2
    qiayue  
    PRO
       Sep 27, 2012
    PHP函数的参数,默认是传值的,如果你想传引用,就在该变量前加“&”符号。
    yetone
        3
    yetone  
       Sep 27, 2012
    我想说代码块,被 Ruby 『荼毒』了…
    holystrike
        4
    holystrike  
       Sep 27, 2012
    从来不用按引用传递
    相当evil
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1286 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 17:18 · PVG 01:18 · LAX 10:18 · JFK 13:18
    ♥ Do have faith in what you're doing.