|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-07 06:18 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2016-04-07 06:18 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 12:00:01 2025 UTC |
Description: ------------ When variable passed by reference is used in switch() it becomes local for that scope Test script: --------------- <?php function bug( &$var ) { switch( $var ) { case 1: $var = 2; } } function workaround( &$var ) { $val_local = $var; switch( $val_local ) { case 1: $var = 2; } } $var = 1; bug( $var ); echo $var , PHP_EOL; $var = 1; workaround( $var ); echo $var , PHP_EOL; ?>