Re: Formatting an ECHO statement.
| From: | Steve Staples | Date: | Mon, 18 Oct 2010 13:47:58 +0000 |
| Subject: | Re: Formatting an ECHO statement. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308789@lists.php.net to get a copy of this message | ||
On Mon, 2010-10-18 at 09:25 -0400, Paul M Foster wrote:
> On Mon, Oct 18, 2010 at 03:40:03PM +0530, Shreyas Agasthya wrote:
>
> > Team,
> >
> > A bit of silly one but like my book says, there are no dumb questions, I am
> > asking it here.
> >
> > If I have :
> >
> > $other="Whatever";
> >
> > and I do:
> >
> > echo 'Other Comments:' .$other. '<br/>
> >
> > works perfectly well and prints the value. What if I want to, now, italicize
> > the value of $other with the above syntax? How do I achieve it?
> >
> > I know we can do it this way : echo " I am <i>$other</i>"; but I
> > want to
> > learn how to do it with the above syntax like I mentioned earlier.
>
> No, there's no other way to do it. You're outputting to HTML, and if you
> want to have the HTML output italicized, you must surround the term with
> the proper code. And in this case, the proper code is actually '<em>',
> not '<i>'. The '<i>' code is being deprecated.
>
> Paul
>
> --
> Paul M. Foster
>
Another option:
echo 'Other Comments: <span style="font-style: italic;">'.
$other .'</span><br/>';
or create a style sheet, with a class definition for italic.
Steve.