473,382 Members | 1,615 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,382 software developers and data experts.

what am I doing wrong

Im a vb guy trying to figure out some php.

For some reason it wont let me append these together.

$variable = "test";

echo "c:\websites\menu\" . $variable;

dont understand...please help.

Sep 19 '05 #1
7 1084
ho******@hotmail.com wrote:
Im a vb guy trying to figure out some php.

For some reason it wont let me append these together.

$variable = "test";

echo "c:\websites\menu\" . $variable;

dont understand...please help.

Is the second quote seen as escaped by the backslash? Maybe it will echo
"c:\\websites\\menu\\" . $variable

Best regards
Sep 19 '05 #2
ho******@hotmail.com a écrit :
Im a vb guy trying to figure out some php.

For some reason it wont let me append these together.

$variable = "test";

echo "c:\websites\menu\" . $variable;

dont understand...please help.


Ho, you do tell him to consider the final " as a text " instead of the
end of the string... (\ is the escape caracter...)

You just need to tell him it is the \ you want to escape... echo
"c:\websites\menu\\" . $variable;

By the way, isn't variable a reserved word ?

Aphrael...
--
"La demande mondiale d'ordinateurs n'excédera pas cinq machines."
(Thomas Watson, Fondateur d'IBM, 1945)
Sep 19 '05 #3
I noticed that Message-ID:
<11**********************@g43g2000cwa.googlegroups .com> from
ho******@hotmail.com contained the following:
$variable = "test";

echo "c:\websites\menu\" . $variable;


The backslash is the escape character. For it to be a literal backslash
you have to escape it with...uh...a backslash.

echo "c:\\websites\\menu\\" . $variable;

Or you could do

echo "c:\\websites\\menu\\$variable";
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Sep 19 '05 #4
On Mon, 19 Sep 2005 17:37:08 +0100, Geoff Berrow
<bl******@ckdog.co.uk> wrote:
I noticed that Message-ID:
<11**********************@g43g2000cwa.googlegroup s.com> from
ho******@hotmail.com contained the following:
$variable = "test";

echo "c:\websites\menu\" . $variable;


The backslash is the escape character. For it to be a literal backslash
you have to escape it with...uh...a backslash.

echo "c:\\websites\\menu\\" . $variable;


or put a bit less stress on the server

echo 'c:\websites\menu\' . $variable;
--
Regards, Paul Herber, Sandrila Ltd. http://www.pherber.com/
SanDriLa - SDL/MSC/TTCN/UML2 application for Visio http://www.sandrila.co.uk/
Sep 19 '05 #5
Need to escape backslashes in PHP. Try echo "c:\\websites\\menu\\" .
$variable.

Sep 19 '05 #6
JDS
On Mon, 19 Sep 2005 09:20:13 -0700, ho******@hotmail.com wrote:
For some reason it wont let me append these together.

$variable = "test";

echo "c:\websites\menu\" . $variable;

dont understand...please help.


Blame it on Microsoft

--
JDS | je*****@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

Sep 20 '05 #7
actullay no need for blaming any 1
the correct way is
- to escape the last backslash:
$var="test";

echo "C:\web\menu\\".$var;
---------------------------------------------
the optimum solution for the case is :
$var='test'; //singl qoutes
echo 'C:\web\menu\\'.$var; //singl qoutes

---------------------------------------------
in double qutes PHP will seek for some varaiable inluded with a string
so in first solution you may make it like :

$var="test";

echo "C:\web\menu\\$var";

Sep 20 '05 #8

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

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
11
by: Alfonso Morra | last post by:
Hi, I am at the end of my tether now - after spending several days trying to figure how to do this. I have finally written a simple "proof of concept" program to test serializing a structure...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
16
by: Ajay | last post by:
Hi all, i want to know when i create a class.what all it contains.I know the following things are there by default if i do not declare them by myself.Please tell the other things that are left. ...
8
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the...
0
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the...
10
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.