I'm trying to print out the value of a variable
within another string.
Here is what I'm trying to do:
$output = '<section >'
$alignment
has the value of left
or right
. The above renders when inspecting:
<section >
I have also tried:
$output = ' <section >'
But this renders:
<section >
And have also tried:
$output = ' <section >'
But this renders:
<section >
I have tried all methods I've seen on other SO questions, but can't get it printing the value?
CodePudding user response:
This code of yours should work
$output = ' <section >'
If it doesn't then the $alignment variable is just empty or doesn't exist, try an "echo $alignment" before your $output line to see if you get something.