|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-19 09:32 UTC] alan_k@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 17:00:01 2025 UTC |
Description: ------------ Class constructor sets a var to a value that is only assigned to an other var. Reproduce code: --------------- <?php class FG_Timestamp{ var $timestamp; var $limit; function FG_Timestamp($ts=-1) { $this->$timestamp=0; $this->$limit=1; echo "1 val limit=".$this->$limit."<br>"; if ($ts<0) $this->$timestamp=time(); else $this->$timestamp=2; echo "2 val limit=".$this->$limit."<br>"; } } $cmp=new FG_Timestamp(0); ?> Expected result: ---------------- 1 val limit=1 2 val limit=1 Actual result: -------------- 1 val limit=1 2 val limit=2