Re: how to concat strings?
| From: | Thargor | Date: | Wed, 07 Nov 2001 18:13:25 +0000 |
| Subject: | Re: how to concat strings? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73772@lists.php.net to get a copy of this message | ||
Hallo Alejandro,
Wednesday, November 07, 2001, 7:04:38 PM, you wrote:
> I need to concat 2 strings and the result to be a variable name. ie:
> I need to concat "checkbox" and "1" so I would do:
> $var=checkbox.1
> and checkbox1 is a variable that already exist, so I want to print its
> value. Something like: echo "$var" and the content of $checkbox1 must be
> displayed. Any ideas??
<?
$checkbox1=hola;
$checkbox2=don;
$checkbox3=pepito;
$checkbox4=don;
$checkbox5=josé;
for ($i=1; $i<=5; $i++){
$varname="checkbox".$i;
echo "variable nº $i:".$$varname."<p>";
}
?>
--
Thargor mailto:Thargor@vergessene-welt.de
http://www.vergessene-welt.de