Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid redefining variables on each iteration #112

Open
IanDelMar opened this issue Dec 24, 2024 · 0 comments
Open

Avoid redefining variables on each iteration #112

IanDelMar opened this issue Dec 24, 2024 · 0 comments

Comments

@IanDelMar
Copy link

foreach( $transports as $key => $transport ) {
$urls = array(
'default' => POST_SMTP_URL . '/Postman/Wizard/assets/images/smtp.png',
'smtp' => POST_SMTP_URL . '/Postman/Wizard/assets/images/smtp.png',
'gmail_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/gmail.png',
'mandrill_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/mandrill.png',
'sendgrid_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/sendgrid.png',
'mailgun_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/mailgun.png',
'sendinblue_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/brevo.png',
'postmark_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/postmark.png',
'sparkpost_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/sparkpost.png',
'mailjet_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/mailjet.png',
'sendpulse_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/sendpulse.png',
'smtp2go_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/smtp2go.png',
'office365_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/ms365.png',
'elasticemail_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/elasticemail.png',
'aws_ses_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/amazon.png',
'zohomail_api' => POST_SMTP_URL . '/Postman/Wizard/assets/images/zoho.png'
);

$urls is redefined on each iteration. However, the content of $urls does not change during the loop. Hence, $urls should be defined outside the loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant