Re: Display variable within a variable.
| From: | Ignacio Vazquez-Abrams | Date: | Wed, 03 Jan 2001 19:37:29 +0000 |
| Subject: | Re: Display variable within a variable. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-32535@lists.php.net to get a copy of this message | ||
On Wed, 3 Jan 2001, Miles Thompson wrote:
> 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
>
http://www.php.net/manual/html/function.printf.html
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>