|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-07 01:23 UTC] pollita@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 25 22:00:01 2025 UTC |
Description: ------------ I have a variable called $config['sold_email_winner_message'], which has an emal message template stored in the variable. Within this email message, i have information like: Dear $winner_info[first_name] $winner_info[last_name], Congrates... I use eval to evaluate the string. One thing I noticed is that the following doesn't work $winner_info['first_name'] $winner_info['last_name'], but $winner_info[first_name] $winner_info[last_name] does work. One would think that these should be interchangeable. Reproduce code: --------------- $winner_info = array ('first_name' => "First", 'last_name' => "Last"); This doesn't work: $config['sold_email_winner_message'] = "Dear $winner_info['first_name'] $winner_info['last_name']"; eval ("\$config[sold_email_winner_message] = \"$config[sold_email_winner_message]\";"); This does work: $config['sold_email_winner_message'] = "Dear $winner_info[first_name] $winner_info[last_name]"; eval ("\$config[sold_email_winner_message] = \"$config[sold_email_winner_message]\";"); Expected result: ---------------- This will print the following: Dear First Last Actual result: -------------- This will print the following: Dear $winner_info['first_name'] $winner_info['last_name']