473,388 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to embed variables into string?

Hello,

Anybody know whether it is meter which of the following two string to
use?
print "<table width=\"$width%\">";
print "<table width=\"".$width."%\">";

Jul 17 '05 #1
6 2091
On 2005-07-11, op*********@yahoo.com <op*********@yahoo.com> wrote:
Hello,

Anybody know whether it is meter which of the following two string to
use?
print "<table width=\"$width%\">";
print "<table width=\"".$width."%\">";


I prefer

print "<table width='{$width}'/>";

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Jul 17 '05 #2
op*********@yahoo.com wrote:
print "<table width=\"$width%\">";
print "<table width=\"".$width."%\">";


IMO the easiest way would be:

echo '<table width="'.$width.'%">';

So you dont have to write the \'s
Jul 17 '05 #3
JDS
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("/</", ">", "<");
--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Jul 17 '05 #4
op*********@yahoo.com wrote:
Hello,

Anybody know whether it is meter which of the following two string to
use?
print "<table width=\"$width%\">";
print "<table width=\"".$width."%\">";


call me stupid, but should the width not be in the style sheet?
Jul 17 '05 #5
>> Anybody know whether it is meter which of the following two string to
use?
print "<table width=\"$width%\">";
print "<table width=\"".$width."%\">";


call me stupid, but should the width not be in the style sheet?

Probably yes, but it is not related to PHP.
Hilarion
Jul 17 '05 #6
"Cristian Gutierrez" <cr******@dcc.uchile.cl> wrote in message
news:87************@guti.no-ip.org...
Este lunes, je*****@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
Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning...
2
by: Cris Curtis | last post by:
When I use an embed tag that uses a dynamic aspx page, the dynamic aspx page appears to get called 2 times instead. Below is code that adds an embed tag to a placeholder control that will use...
2
by: Mark1249 | last post by:
Hello, I am using ASP.NET 2 and using the CreateUserWizard I am wanting an email to go out to the new user informing them of their account details etc... I have a BodyFileName in the...
24
by: Manuel | last post by:
Is it possible to embed an image, like a company logo in a CDOSYS generated message? If yes, I´ll apreciate some code sample. I´ve been able to format messages in html the way I like, but I...
8
by: CodeLeon | last post by:
Hi, All. I am creating a setup program. The way it works is that the user creates their setup info, my program generates the C# code for a setup executable, embeds the xml file containing the info...
0
by: =?Utf-8?B?Tml5YXpp?= | last post by:
Hi all, Does anyone know how to embed the Excel file in VB.NET 2005 Resources? Here is what I am doing at the moment: 1) In my VB.NET 2005 project code I load the excel with it path into...
2
polymorphic
by: polymorphic | last post by:
I am no longer good at Javascript and need help. I'm trying to embed pdf files in html then build some sort of navigation between the pdfs via the pdf numbered file name. I can generate the...
5
by: elbin | last post by:
Hello, first to say that I am a total beginner in Javascript but I know some programming (python in particular) and am able to understand methods/parameters and so on. Here's my problem: I am...
0
by: =?Utf-8?B?TWFyazEyMw==?= | last post by:
I have two pieces of VB.NET code below: a) Sends an email b) Returns a programmatically created jpeg image to a webpage. How can I embed the programmatically created jpeg into an HTML...
2
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.