div里面的php变量高度

I have the following php statement,

echo "<div style=\"background-image: url('$logo'); height: '$ratioxy';\"></div>";

I did this to make the height of the div variable depending on the background image. The code correctly inserts the $logo variable, but not the $ratioxy variable. The variable $ratioxy gives a value when I echo it, but it won't give the value inside the div. Is there any reason for this? Thanks in advance.

Try to use:

echo "<div style=\"background-image: url('{$logo}'); height: {$ratioxy}px;\"></div>";

Height should be specified with units (%, px, em, etc) because "just some digits" are not obvious for browser. Also it should be specified without quotes.