Skip to content

Instantly share code, notes, and snippets.

@d9k
Last active August 29, 2015 14:06
Show Gist options
  • Save d9k/62e483ce2dcd37c85eb4 to your computer and use it in GitHub Desktop.
Save d9k/62e483ce2dcd37c85eb4 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
define(BR, '<br />'."\n");
$a = ['t1' => 3, 't2' => 5];
$f1 = function () use ($a){
echo $a['t1'] , ' ', $a['t2'] , BR;
};
$f2 = function () use (&$a){
echo $a['t1'] , ' ' , $a['t2'] , BR;
};
$a['t2'] = 7;
$f1(); // 3 5
$f2(); // 3 7
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment