Re: <OPTION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings wrote:
> On Thu, 2006-10-26 at 22:44 +0200, Jochem Maas wrote:
>> Robert Cummings wrote:
>>> On Thu, 2006-10-26 at 15:31 +0200, Jochem Maas wrote:
>>>> bunch of space wasters ;-)
>>>>
>>>> <?php foreach (range(1, 31) as $d) echo '<option value="',$d,'"',($d = $selDay?'
>>>> selected="selected"':''),'>',$d,'</option>'; ?>
>>> Specifically:
>>>
>>>> range(1, 31)
>>> Memory waster ;)
>> any idea as to what the damage is as compared to the classic for loop?
> 
> Given that a variable probably costs X and that any variable cane be
> stored as Y in an array, and an array would cost Z where the Z = X * Y _
> 1 (Y element + 1 for the array container itself).
> 
> Then the range format would cost 31 + 1 (the array itself + 31 entries)
> whereas the for loop would cost 1 + 1 (cost to store i + cost to store
> endpoint comparison. Thus the damage is about 15*. Given general
> computer science consideration, this is a constant and thus practically
> neglible.
> 
> Cheers
> Rob (ps. the above may be completely incoherent since I'm completely
> drunk atm after celebrating two friends birthdays tonight).

not a bad explainantion then ;-) it's only the last bit I didn't quite follow :-)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux