On Tue, Jun 08, 2010 at 04:12:42PM +0300, Tanel Tammik wrote: > Hi, > > which one is correct or "better"? > > $array[3] = ''; > or > $array['3'] = ''; If the index for (integer) 3, the first example is correct. If the index is (string) '3', the second example is correct. > > $i = 7; > > $array[$i] = ''; > or > $array["$i"] = ''; > There's no reason to use "$i". The end result will be the same, but in the case of "$i", you're forcing the PHP interpreter to interpret the string "$i", looking for variables (like $i), and output whatever else is in the string (which in this case is nothing). Also, if $i is an integer, you have the same problem as above. In the first case, you get $array[7]. In the second case, you get $array['7']. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php