如何在PHP中添加空间

echo "<h1 class='price'>" . $currency . round( $price['daily'] ) . "</h1>"; 

Is there a way to print empty space before currency?

Edit: The above code gives me From₹3880 in my theme. But I want From $3880 with a space

PS: Noob here

Use the non-breaking space (&nbsp;) HTML entity:

echo "<h1 class='price'>&nbsp;" . $currency . round( $price['daily'] ) . "</h1>"; 

Adding a space inside the quotes should do the trick.

echo "<h1 class='price'> " . $currency . round( $price['daily'] ) . "</h1>"; 

h1 is a block-level element. Unless you've modified its style, it will have some margin and padding from the browser by default. So, adding a space here doesn't make sense. Fix it in CSS, don't abuse HTML for layout.

echo "<h1 class='price'> {$currency} ". round( $price['daily'] ) . "</h1>"; 

or better still use  

echo "<h1 class='price'> &nbsp;" . $currency . round( $price['daily'] ) . "</h1>";

Go through the following link

http://www.w3schools.com/html/html_entities.asp