Re: [SMARTY] new plugin: mailto
| From: | Kelly Cochran | Date: | Tue, 21 May 2002 23:03:53 +0000 |
| Subject: | Re: [SMARTY] new plugin: mailto | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4345@lists.php.net to get a copy of this message | ||
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/