PHP: pass a variable to a function, do something to the variable, return it back

前端 未结 5 1917
孤街浪徒
孤街浪徒 2021-01-22 11:39

Assuming the following code:



        
5条回答
  •  臣服心动
    2021-01-22 12:25

    You should try this :

    $rowCount = 1;
    echo $rowCount.' and ';
    $rowCount = doStuff($rowCount);
    $rowCount = doStuff($rowCount);
    $rowCount = doStuff($rowCount);
    

    Your doStuff() method returns an int that is never used when you simply use the statement doStuff($rowCount); without assignation.

提交回复
热议问题