RE: [PHP] quick syntax question
| From: | Cynic | Date: | Sat, 23 Dec 2000 12:57:11 +0000 |
| Subject: | RE: [PHP] quick syntax question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31669@lists.php.net to get a copy of this message | ||
ok, so... are you looking for something like this?
echo ${ $answer . $question } ;
echo ${ "answer_$question" } ;
echo ${ 'answer_' . $question } ;
At 13:35 23.12. 2000, indrek siitan wrote the following:
--------------------------------------------------------------
>Hi,
>
>> what are you trying to achieve?
>> why are you using the varvar?
>> I'm probably asking dumb questions... If so, excuse me,
>> I've spent last 24hrs coding...
>> wouldn't use of array make things easier?
>> something along the lines of:
>> $faq =
>> array(
>> 1 => array(
>> 'q' => 'how can I...' ,
>> 'a' => 'Easily...'
>> ) ;
>> 2 => array(
>> 'q' => 'Where is the...' ,
>> 'a' => 'In the manual...'
>> ) ;
>> ) ;
>> then you can just echo $faq[1]['q'] or $faq[1]['a']
>
>i have a dynamically created form, the answers of which i have
>to parse. to distinguish the answers from other variables passed
>along, i have prefixed them with "question_" prefix. so I can just
>go through the $HTTP_POST_VARS array and pick out everything
>that begins with question_ ..
>
>hope that's clear enough :)
>
>and, i'm fine with with the interim variable, just asked the
>question to see if there's another neat trick to make the code
>look simpler (as there almost every time is :)).
>
>
>Rgds,
> Tfr
>
> --==< tfr@cafe.ee >==< http://tfr.cafe.ee/ >==<
> +372-50-17621 >==--
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz