Mohammad Mohammad - 3 months ago 7
PHP Question

How can set two ' (apostrophe) together in echo

I have this code :

echo ' <style> #post_sx {background:url('../images/posts/T_P1.png') right center no-repeat;} </style>';


The
character after echo and
character in background url address can't be together I forgot how can solve this?

and when I use :

echo ' <style> #post_sx {background:url("../images/posts/T_P1.png") right center no-repeat;} </style>';


Style doesn’t work properly.

Can you help me?

Answer

Using double quotes instead of single quotes for the string allows you to use single quote inside it:

echo "string with 'quotes' inside";