PHP code example of samlitowitz / unset-foreach-loop-references

1. Go to this page and download the library: Download samlitowitz/unset-foreach-loop-references library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

samlitowitz / unset-foreach-loop-references example snippets


$a = [1, 2, 3];
foreach ($a as &$r1) {
}
foreach ($a as $v) {
	print_r($a);
}

$a = [1, 2, 3];
foreach ($a as &$r1) {
}
foreach ($a as $v) {
	print_r($a);
}
unset($r1);

$a = [1, 2, 3];
foreach ($a as &$r2) {
}
unset($r2);


    - vendor/samlitowitz/unset-foreach-loop-references/rules.neon