Display variable within a variable.
| From: | Miles Thompson | Date: | Wed, 03 Jan 2001 18:53:17 +0000 |
| Subject: | Display variable within a variable. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32534@lists.php.net to get a copy of this message | ||
I know I can do this by splitting my error message, but I'm wondering if there is any way of doing it by display a variable within a string contained in another variable.
I have all prompts and error messages stored in a database table, fetch them according to the language required, and display them by using this general form: echo $arr_lbl[ lbl_Usernam ]. This would display "Username" for English, "Benuztername" for German.
If a user's bid fails, I call this: echo $arr_lbl[ lbl_cMsgBidFail ]
which contains this text:
"Thank you for your bid. To be accepted it must increase the previous bid by $yMinBidIncr. Please adjust the amount and send it again." $yMinBidIncr is the amount by which this bid must exceed the previous bid.
What happens, of course, is that $yMinBidIncr doesn't exist when the prompts are fetched, so resolves to "" and does not display.
Is there a way of inserting this into $arr_lbl[ lbl_cMsgBidFail ]?
Miles Thompson