kuredev
11/18/2017 - 3:08 PM

リファレンス渡しの小さなメモ

リファレンス渡しの小さなメモ

<?php

function test1($n){
    $n++;
}

function test2(&$n){
    $n++;
}

$num = 0;
test1($num);
echo $num.PHP_EOL;
test2($num);
echo $num.PHP_EOL;