Confused about foward slashes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ddoc
Forum Newbie
Posts: 2
Joined: Mon Jun 30, 2003 10:33 am

Confused about foward slashes

Post by ddoc »

I am getting very confused with the issue of forward slashes in variables. In my application I have something like this, which works fine:

$poo="images/ad/";
$oop="ad1.gif";
for($x=0;$x<=10;$x++)
{
$z=$poo.$oop;
echo "z = ".$z."<br>";
echo "<img src=\"$z\">";
}

When I look at the new variable $z I get a pathname and filename. When I put these into HTML (from with <?php .. ?> ), as ;

echo "<img statement as the src=\"$z\">";

it isn't even echo'd

Can anyone tell me what is wrong ?

Many thanks
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

what does it output?
ddoc
Forum Newbie
Posts: 2
Joined: Mon Jun 30, 2003 10:33 am

Post by ddoc »

if I make $poo="images/ad";

then concat them together, the <img is recognised and an image holder is created. If $poo="images/ad/"; then nothing gets eco'd at all. So it seems to be the trailing forwards slash that causes the problem.
Post Reply