我有以下代码:
<?php
$array1 = array("The price of Mac"=>2000, "One year refundable"=>"Yes", "24/7 support"=>"Yes");
foreach ($array1 as $index => $value) {
if(is_int($value)) {
echo "{$index} is ${$value}, ";
} else {
echo "{$index} is {$value}, ";
}
}
echo "</ br>";
?>
但是 2000 美元没有出现,当我在行中放一个空格时
if(is_int($value)) {
echo "{$index} is $ {$value}, ";
}
出现$ 2000
了,但如何输出2000美元?