TobesC Posted October 22, 2008 Share Posted October 22, 2008 I have a situation where different variable values cause a different variable to have a word value. switch ($a) { case 1: $var="var1"; break; case 2: $var="var2"; break; etc. } is there a way i can write a while loop to read a text file inside the switch statement to save myself some time? thanks. Link to comment https://forums.phpfreaks.com/topic/129519-nested-while-loop/ Share on other sites More sharing options...
MasterACE14 Posted October 22, 2008 Share Posted October 22, 2008 of course, you can have as much PHP within a case of a switch as you want.... <?php switch ($a) { case 1: $var="var1"; while(whatever is in equal to something) { do something increment counter } break; case 2: $var="var2"; break; etc. } Link to comment https://forums.phpfreaks.com/topic/129519-nested-while-loop/#findComment-671527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.