coder9 Posted July 19, 2008 Share Posted July 19, 2008 good evening. shorter version of this codes? switch ($link) { case 1: $tmpbakcolor[1]="#C0C0C0"; break; case 2: $tmpbakcolor[2]="#C0C0C0"; break; case 3: $tmpbakcolor[3]="#C0C0C0"; break; case 4: $tmpbakcolor[4]="#C0C0C0"; break; case 5: $tmpbakcolor[5]="#C0C0C0"; break; case 6: $tmpbakcolor[6]="#C0C0C0"; break; case 7: $tmpbakcolor[7]="#C0C0C0"; break; case 8: $tmpbakcolor[8]="#C0C0C0"; break; case 9: $tmpbakcolor[9]="#C0C0C0"; break; case 10: $tmpbakcolor[10]="#C0C0C0"; break; more codes here... case 100: $tmpbakcolor[100]="#C0C0C0"; break; default: echo ""; } loop? thank you. Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/ Share on other sites More sharing options...
DarkWater Posted July 19, 2008 Share Posted July 19, 2008 $tmpbakcolor[$link] = "#C0C0C0"; What are you actually trying to do here though....? Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/#findComment-594458 Share on other sites More sharing options...
coder9 Posted July 19, 2008 Author Share Posted July 19, 2008 while($i<=100) { if($i == $link) { $tmpbakcolor[$link]="#C0C0C0"; } $i++; solved! Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/#findComment-594462 Share on other sites More sharing options...
DarkWater Posted July 19, 2008 Share Posted July 19, 2008 My code is a lot shorter and faster. Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/#findComment-594464 Share on other sites More sharing options...
coder9 Posted July 19, 2008 Author Share Posted July 19, 2008 My code is a lot shorter and faster. Where DarkWater? Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/#findComment-594466 Share on other sites More sharing options...
DarkWater Posted July 19, 2008 Share Posted July 19, 2008 $tmpbakcolor[$link] = "#C0C0C0"; I meant to post that as response code, THEN ask what you were actually trying to do. >_> Link to comment https://forums.phpfreaks.com/topic/115639-solved-can-this-codes-be-make-shorter/#findComment-594468 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.