Member Avatar
echo ("<a href=foldername/".$file.">".$file."</a>"."<br>");

and there

$file = readdir($handle);

in that case $file is a folder name with space.. So I have to put double quotation after href=. But it doesnt printing that double quotation. The link I am getting is only the folder name's first thing before space. So the link Generating is wrong...

Please help me..

Recommended Answers

Hi, there are several methods of printing double quotes, two of them are:

1) Using single quotes:
echo '<a href="http://www.example.com">Example</a>';

2) Escaping in double quotes:
echo "<a href=\"

Jump to Post

right my mistake it should be
echo '<a href="quotations/' . $file . '">' . $file . '</a><br />';

I misplaced the second double quote.

Jump to Post

All 6 Replies

Hi, there are several methods of printing double quotes, two of them are:

1) Using single quotes:
echo '<a href="http://www.example.com">Example</a>';

2) Escaping in double quotes:
echo "<a href=\"http://www.example.com\">Example</a>";

I'd recommend sticking to single quotes since its more readable and has better micro performance because it doesn't interpolate variables as double quotes do, that is -

$x = 42;
echo "My value: $x"; // prints: My value: 42
echo 'My value: $x'; // prints: My value: $x

Member Avatar

Hi, there are several methods of printing double quotes, two of them are:

1) Using single quotes:
echo '<a href="http://www.example.com">Example</a>';

2) Escaping in double quotes:
echo "<a href=\"http://www.example.com\">Example</a>";

I'd recommend sticking to single quotes since its more readable and has better micro performance because it doesn't interpolate variables as double quotes do, that is -

$x = 42;
echo "My value: $x"; // prints: My value: 42
echo 'My value: $x'; // prints: My value: $x

echo ('<a href="quotations/$file">'.$file.'</a><br>');

I have tried this but getting this link
"foldername/$file"

Help..

True because single quote don't interpolate variables, you'll have to use the concat operator (dot) :


echo '<a href="quotations/"' . $file . '>' . $file . '</a><br />';

Member Avatar

True because single quote don't interpolate variables, you'll have to use the concat operator (dot) :


echo '<a href="quotations/"' . $file . '>' . $file . '</a><br />';

Now not getting the first name(before space)
Getting this only..
"quotations/"

right my mistake it should be
echo '<a href="quotations/' . $file . '">' . $file . '</a><br />';

I misplaced the second double quote.

Member Avatar

right my mistake it should be
echo '<a href="quotations/' . $file . '">' . $file . '</a><br />';

I misplaced the second double quote.

Hey thanks...
It works..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.