RE: [PHP] quick syntax question
| From: | o dot cook at etoncollege dot org dot uk | Date: | Sat, 23 Dec 2000 12:30:37 +0000 |
| Subject: | RE: [PHP] quick syntax question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31667@lists.php.net to get a copy of this message | ||
Maybe arrays would be useful in this situation
$question = 10;
$answer[10] = "Foo";
echo $answer[$question]; # Should return "Foo"
Ollie
> -----Original Message-----
> From: indrek siitan [mailto:tfr@cafe.ee]
> Sent: 23 December 2000 12:18
> To: php-general@lists.php.net
> Subject: [PHP] quick syntax question
>
>
> Hi,
>
> is there a possibility to do the following without the interim
> variable?
>
> $question=10;
> $answer_10="Foo";
> $var="answer_".$question;
> echo $$var;
>
>
> Rgds,
> Tfr
>
> --==< tfr@cafe.ee >==< http://tfr.cafe.ee/
> >==<
> +372-50-17621 >==--
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>