Re: Representing a variable
| From: | Ron Piggott | Date: | Sun, 26 Apr 2015 12:41:51 +0000 |
| Subject: | Re: Representing a variable | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324830@lists.php.net to get a copy of this message | ||
On 26/04/15 08:28, Ashley Sheridan wrote:
On 26 April 2015 13:17:35 BST, "Stefan A." <acid24@gmail.com> wrote:This isn't working. I am receiving the error: Parse error: syntax error, unexpected '{', expecting ']' on line 3 <?php $params['en-US_translation'] = 'Test'; $value = 'en-US'; echo $params[{$value . '_translation'}]; ?>If I understood correctly, this should work: $params["$value_translation"] On Sun, Apr 26, 2015 at 2:52 PM, Ron Piggott <ron.piggott@actsministries.orgThat would be looking for a variable called $value_translation which doesn't exist here. what you're already using Ron is perfectly acceptable.wrote: I am wondering how to correctly represent the variable $params['en-US_translation'] $value = 'en-US'; What I currently have is $params[{$value . '_translation'}] Thank you. Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php