note 56168 rejected from function.array-fill by sean

From: Date: Thu, 25 Aug 2005 15:43:29 +0000
Subject: note 56168 rejected from function.array-fill by sean
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-94187@lists.php.net to get a copy of this message
Note Submitter: frrogoy at sbcglobal dot net ---- array_fill doesn't appear to work nicely if there are more than one element at a level. It redimensions the array. I had an array that looked like: $wk_array = array(1 => array(1=>0,2=>0), 2 => array(1=>0,2=>0), 3 => array(1=>0,2=>0), 4 => array(1=>0,2=>0)); I tried to zero the 1st element at the 2nd level using: $wk_array = array_fill(1,4,array_fill(1,1,0)); I wanted to accumulate totals in the 2nd element. A print_r after the array_fill showed that the array looked like array(1 => array(1=>0),2 => array(1=>0), etc.)

« previous php.notes (#94187) next »