RE: [PHP] HOW CAN I PROCESS LARGE AMOUNT OF DATA?

From: Date: Wed, 07 Nov 2001 08:52:56 +0000
Subject: RE: [PHP] HOW CAN I PROCESS LARGE AMOUNT OF DATA?
Groups: php.general 
Request: Send a blank email to php-general+get-73698@lists.php.net to get a copy of this message
> in my display.php > <? > for (i=0;i<10;i++) > { > echo ("$id_$i, $name_$i, $room_num_$i"); > // i want to echo > // id_1, name_1, room_num_1 > // id_2, name_2, room_num_2 > // id_3, name_3, room_num_3 > // id_4, name_4, room_num_4 > // this does not work, but how cna i work out? > } > ?> You use variables that hold the name of the variable you want to access, and access it as $$varaiblename. $i gives the value of "i". $$i gives the value of the variable whose name is contained in "i". <? for (i=0;i<10;i++) { $idvalue = "id_$i"; $namevalue = "name_$i"; $roomnumvalue = "room_num_$i"; echo ($$idvalue.", ".$$namevalue.", ".$$roomnumvalue); } ?> Jason

« previous php.general (#73698) next »