Re: Variable variables and classes in PHP 3
| From: | Pablo Pasqualino | Date: | Thu, 23 Nov 2000 17:51:01 +0000 |
| Subject: | Re: Variable variables and classes in PHP 3 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26852@lists.php.net to get a copy of this message | ||
Well
I fixed it myself... :)
it was more easy of what it think
for those that someday have the same problem, use a temp var
$temp_chica = $$chica;
$temp_grande = $$grande;
now
$temp_chica->imagen will work
PP> Hi
PP> I am having problems with the following code
PP> $cantidad = 5;
PP> for ($x = 1; $x <= $cantidad; $x++) {
PP> $chica = 'img_i'.$x.'c';
PP> $grande = 'img_i'.$x.'g';
PP> $nombre_c = 'i'.$x.'c';
PP> $nombre_g = 'i'.$x.'g';
PP> $size_c = 'i'.$x.'c_size';
PP> $size_g = 'i'.$x.'g_size';
PP> $type_c = 'i'.$x.'c_type';
PP> $type_g = 'i'.$x.'g_type';
PP> $$chica = new Upload($$nombre_c,$$size_c,$$type_c);
PP> $$grande = new Upload($$nombre_g,$$size_g,$$type_g);
PP> if (($$chica->imagen) && (${$grande}->imagen) &&
PP> (${$chica}->med(85,65))) {
PP> ... some code ...
PP> };
PP> The error appears when I refer $$chica->imagen or similar
PP> How can I do it in PHP 3?
PP> I also tried writing ${$chica}->imagen but it doesnt work
PP> It works fine in PHP 4, but in my web server I just can use PHP 3 :(
PP> I hope someone can help
PP> thanks!
Pablo Pasqualino
Mar del Plata, Argentina
http://www.marplatense.com