hiya
I'd like to optimize a code snippet I wrote:
------------------------------------------------------------------------
while ($Girl = each($Girls)){
$AttGirl = "Attitude$Girl[value]";
if ($$AttGirl && ("-" != $$AttGirl))
$query .= " AND (swimsuits.attitude_" . strtolower($Girl[value]) . " = '" . $$AttGirl . "')";
}
------------------------------------------------------------------------
It would be quite cool if I could drop the second line. But I don't know
how to tackle this.
$Girls is a simple array:
$Girls = array('Ayane','Christie','Helena','Hitomi','Kasumi ','Leifang','Lisa','Tina');
It's quite possible that I'm on the wrong track and there's a much
cleaner approach. The above code resulted from optimizing this:
------------------------------------------------------------------------
if ($AttitudeAyane && ("-" != $AttitudeAyane))
$query .= " AND (swimsuits.attitude_ayane = '$AttitudeAyane')";
if ($AttitudeChristie && ("-" != $AttitudeChristie))
$query .= " AND (swimsuits.attitude_christie = '$AttitudeChristie')";
[repeat for other girls]
------------------------------------------------------------------------
$AttitudeAyane is defined elsewhere an may hold no value or something
along the lines of -,0,1,2,3,4 or 5
tschüß
thomas
--
Music->Playing: In Strict Confidence - Herzattacke
Who am I? Am I the|As the silence fades away / I gather strength for another day
only me? I am the|Another day I've to go through / Another day here without you
only me... right? |-- "Another day", L´âme Immortelle