변수 이름의 일부를 생성 할 때 mysql 데이터를 사용하여 이미 다른 곳에서 선언 된 다른 변수를 참조하려고합니다. 기본적으로 $ damage_name을 if 문 부울 검사의 일부로 가져올 수 있습니까?배열을 사용하여 변수 이름 설정
$conditions = array(
'bent_num' => 0,
'spine_torn' => 0,
'pages_torn' => 0,
'water_damage' => 0,
'pages_highlighted' => 0,
'pages_noted' => 0,
'taped' => 0,
'stained' => 0,
'mold' => 0,
'scratched' => 0
);
while ($row = mysql_fetch_assoc($res))
{
$damage_name = $conditions[$row['type']];
if (isset($conditions[$row['type']]) && $_SESSION[SELL_is_ . $damage_name . ]; == 'y')
{
$condition_score = $condition_score - $row['value'];
}
}
오 멋진 감사 –