#26514 [Opn->Bgs]: Static variables double

From: Date: Thu, 04 Dec 2003 07:08:49 +0000
Subject: #26514 [Opn->Bgs]: Static variables double
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51658@lists.php.net to get a copy of this message
ID: 26514 Updated by: sniper@php.net Reported By: grandadmirale at yahoo dot com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: WinXP PHP Version: 4.3.4 New Comment: This is exactly what 'static' does.. RTFM: http://www.php.net/manual/en/language.variables.scope.php Previous Comments: ------------------------------------------------------------------------ [2003-12-03 14:53:21] grandadmirale at yahoo dot com Description: ------------ When using static variables and the .= operand, the static variable doubles itself. Reproduce code: --------------- function test() { static $test = ''; $test .= 'lala|'; echo $test; } test(); test(); test(); Expected result: ---------------- lala|lala|lala| Actual result: -------------- lala|lala|lala|lala|lala|lala| ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26514&edit=1

« previous php.bugs (#51658) next »