[FX.php List] Memories....MORE
Dale Bengston
dbengston at tds.net
Wed May 12 09:55:35 MDT 2010
Yes, I've done that as well.
Dale
On May 12, 2010, at 10:43 AM, Leo R. Lundgren wrote:
> Or even better, some nicely designed classes.
>
> 12 maj 2010 kl. 17.41 skrev Dale Bengston:
>
>> Pretty much anything I do or use more than once gets made into a function.
>>
>> Dale
>>
>> On May 12, 2010, at 10:32 AM, VanBuskirk, Patricia wrote:
>>
>>> I've done a couple out of necessity.
>>>
>>>
>>> -----Original Message-----
>>> From: fx.php_list-bounces at mail.iviking.org
>>> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Jonathan
>>> Schwartz
>>> Sent: Wednesday, May 12, 2010 10:58 AM
>>> To: FX.php Discussion List
>>> Subject: Re: [FX.php List] Memories....MORE
>>>
>>> "Ew" accepted.
>>>
>>> That was my next stop: functions.
>>>
>>> A show of hands, please...How many folks on this are writing php
>>> functions?
>>>
>>> I hope that I'm not embarrassing myself....more. ;-)
>>>
>>> Jonathan
>>>
>>>
>>>
>>>> Forgive me Jonathan, but ew.
>>>>
>>>> How about a file called neat_things.php with functions:
>>>>
>>>> function dothis()
>>>> {
>>>> [...]
>>>> }
>>>>
>>>> function dothat()
>>>> {
>>>> [...]
>>>>
>>>> }
>>>>
>>>>
>>>> function dotheother()
>>>> {
>>>> [...]
>>>>
>>>> }
>>>>
>>>>
>>>> function logthis()
>>>> {
>>>> [...]
>>>>
>>>> }
>>>>
>>>>
>>>> Then you set up your file like this:
>>>>
>>>> include (neat_things.php);
>>>>
>>>> foreach (blah)
>>>> {
>>>> dothis();
>>>> logthis();
>>>> dothat();
>>>> logthis();
>>>> dotheother();
>>>> logthis();
>>>> }
>>>>
>>>> Include once, use many times.
>>>>
>>>> Dale
>>>>
>>>> On May 12, 2010, at 9:21 AM, Jonathan Schwartz wrote:
>>>>
>>>>> More on the question about how memory is used during a script...
>>>>>
>>>>> This issue came up as I have created a batch scrip that process
>>>>> multiple records offline.
>>>>>
>>>>> I've come to realize that use of includes, as a tool for
>>>>> simplifying a big script, by definition, requires more memory for
>>>>> each iteration of the loop. Here is a simplistic example:
>>>>>
>>>>> foreach( blah)
>>>>> {
>>>>> include (dothis.php)
>>>>> include (log.php)
>>>>> include (dothat.php)
>>>>> include (log.php')
>>>>> include (dotheother.php)
>>>>> include (log.php')
>>>>> }
>>>>>
>>>>> If the includes are changed to include_once, then the includes
>>>>> don't run after the first instance in the loop..
>>>>>
>>>>> As is, the script runs, requiring more memory for each iteration
>>>>> of the loop....and will eventually run out of memory.
>>>>>
>>>>> Will the same thing happen if I simply remove the includes and
>>>>> dump all the scripts into one big honkin' script?
>>>>>
>>>>> What to do?
>>>>>
>>>>> Jonathan
>>>>> --
>>>>> Jonathan Schwartz
>>>>> Exit 445 Group
>>>>> jonathan at exit445.com
>>>>> http://www.exit445.com
>>>>> 415-370-5011
>>>>> _______________________________________________
>>>>> FX.php_List mailing list
>>>>> FX.php_List at mail.iviking.org
>>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>>
>>>> _______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>>
>>> --
>>> Jonathan Schwartz
>>> Exit 445 Group
>>> jonathan at exit445.com
>>> http://www.exit445.com
>>> 415-370-5011
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> -|
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
More information about the FX.php_List
mailing list