RE: [SMARTY] new plugin: mailto
| From: | Alan McFarlane | Date: | Wed, 22 May 2002 00:46:53 +0000 |
| Subject: | RE: [SMARTY] new plugin: mailto | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4346@lists.php.net to get a copy of this message | ||
or (untested)
for ($i = 0, $j = count($mail_params); $i < $j; $i++)
{
//...
}
--
Alan McFarlane
amcfarlane@bigfoot.com
-----Original Message-----
From: Kelly Cochran [mailto:kcochran@trolans.net]
Sent: 22 May 2002 00:04
To: Smarty General
Subject: Re: [SMARTY] new plugin: mailto
Why not something like:
if(count($mail_parms))
{
$address .= '?' . implode('&', $mail_parms);
}
Then there's now the only one call to count() as well as ditching the now
extraneous incrementer.
Steve wrote:
> Just a minor performance note here:
>
> in this code snippet
> for ($i=0; $i<count($mail_parms); $i++) {
> $mail_parm_vals .= (0==$i) ? '?' : '&';
> $mail_parm_vals .= $mail_parms[$i];
> }
>
> count() is called once for each loop iteration. Obviously in this
context
> that is only a couple of times. But in larger loops, this can become
> expensive. Another way to do it would be to call count once, assign the
> value and put the value in the for loop expression.
-- -
Kelly Cochran - (KC543)
e-mail: kcochran@trolans.net
WWW: http://www.trolans.net/
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php