Skip to content

Instantly share code, notes, and snippets.

@kuredev
Created November 18, 2017 15:08
Show Gist options
  • Select an option

  • Save kuredev/e00ab2be31740f4960ae243b76bd6853 to your computer and use it in GitHub Desktop.

Select an option

Save kuredev/e00ab2be31740f4960ae243b76bd6853 to your computer and use it in GitHub Desktop.
リファレンス渡しの小さなメモ
<?php
function test1($n){
$n++;
}
function test2(&$n){
$n++;
}
$num = 0;
test1($num);
echo $num.PHP_EOL;
test2($num);
echo $num.PHP_EOL;
@kuredev

kuredev commented Nov 18, 2017

Copy link
Copy Markdown
Author

実行結果

0
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment