RE: echo string with question mark in it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brent Clements <mailto:bclem@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
    on Tuesday, November 30, 2004 3:55 PM said:

> I have the following string variable
> 
> $string = 'test.php?id=' . $id;
> 
> but when I echo out the string it looks like this
> 
> test.php?
> id=#########

> How do I make the ? part of the string instead of php evaluating that
> question mark? 
> 
> I've tried adding \ before the ? but it doesn't work.

PHP isn't doing anything special to the ? character. What's happening is
that you probably have a newline character at the start of your $id
variable, that's why it's printing on two lines. The ? is not what's
causing the new line.

For the sake of readability (imo) try writing it like this:

<?php

$string = "test.php?id=$id";

?>

That way you don't have to mess with concatenation.



hth,
Chris.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux