You are here: Re: How to embed variables into string? « PHP Programming Language « IT news, forums, messages
Re: How to embed variables into string?

Posted by Norman Peelman on 07/19/05 13:22

"Cristian Gutierrez" <crgutier@dcc.uchile.cl> wrote in message
news:87k6juvlfo.fsf@guti.no-ip.org...
> Este lunes, jeffrey@example.invalid dijo:
> > On Mon, 11 Jul 2005 20:09:09 +0000, Tim Van Wassenhove wrote:
> >
> >> I prefer
> >>
> >> print "<table width='{$width}'/>";
> >
> > I prefer:
> >
> > $thing1 = "table";
> > $presto = "width";
> > $width = preg_replace("/width/", "30", $presto);
> > echo "<" . $thing1 . " " . $presto . "='" . $width . "'/" .
preg_replace("/</", ">", "<");
>
> My favorite:
>
> $tag = '<table width="%d%%">';
> printf($tag, $width);
>

Too many quotes!

Try:
echo "<$thing1 $presto = '$width'>";

Norm
---
FREE Avatar Hosting at www.easyavatar.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация