Reputation: 53
In a var i want to mix php and html/ inline css, I think i'm almost there with the code below but it keeps failing.
$bgThumb = 'style="background-image:url(' . echo $url . ');"';
Upvotes: 1
Views: 110
Reputation:
no need to echo
$bgThumb = 'style="background-image:url(' . $url . ');"';
Upvotes: 0
Reputation: 1080
You can't have an echo in a variable!!!
$bgThumb = 'style="background-image:url(' . $url . ');"';
then
echo $bgThumb;
Upvotes: 0
Reputation: 5235
No need for echo to concatenate variables:
$bgThumb = 'style="background-image:url(' . $url . ');"';
echo
just displays content in the webpage, it can't be used in the variable.
Upvotes: 1
Reputation: 22893
$bgThumb = 'style="background-image:url(' . $url . ');"';
Upvotes: 2