0
您好我想使用list()函數從函數中檢索兩個變量。該函數返回數組中的變量。無法從函數中檢索多個變量
function thumb_dimensions($case, $image_width, $image_height){
switch($case){
case 1:
$thumb_width = 100;
$thumb_height = 100;
break;
case 2:
$thumb_height = 100;
$ratio = $thumb_height/$image_height;
$thumb_width = round($image_width * $ratio);
break;
case 3:
$thumb_width = 100;
$ratio = $thumb_width/$image_width;
$thumb_height = round($image_height * $ratio);
break;
return array($thumb_width, $thumb_height);
}
}
$case = 3;
list($thumb_width, $thumb_height) = thumb_dimensions($case, $image_width, $image_height);
var_dump(thumb_dimensions($ case,$ image_width,$ image_height))''的結果是什麼? – afuzzyllama