如何在php中的echo语句中打印"$"?

use*_*316 0 php

我有以下代码:

<?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>";
        ?>
Run Code Online (Sandbox Code Playgroud)

但当我在线上放置一个空格时,2000美元没有出现

if(is_int($value)) {
                        echo "{$index} is $ {$value}, ";
                    }
Run Code Online (Sandbox Code Playgroud)

$ 2000节目了,但如何输出$ 2000年?

Joh*_*ica 7

echo "{$index} is \${$value}, ";
Run Code Online (Sandbox Code Playgroud)