Re: echo string with question mark in it

From: Date: Wed, 01 Dec 2004 20:59:39 +0000
Subject: Re: echo string with question mark in it
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203266@lists.php.net to get a copy of this message
Brent Clements wrote: > 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=######### > > ####### is the $id variable value btw. > > 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 ain't doing nuthin' with that ?... Are you looking at this in a browser? Is ####### reallllly long? Is it possible that the browser (or email client) seeing a reallllly long string, has no choice to break it in half *somewhere* and puts it on two lines. And, of course, given that string, the most natural (from a persepctive of the English language) break would be at the "?" TIP: Use "View Source" in your browser to see what PHP is *really* sending. Similar functionality exists in some email clients, in differing names/menus. Oh, and if the break is messing you up in sending a link via email, put < and > around the link like so: echo "<http://test.php?id=################################>"; In *email* the < and > are supposed to tell the email client *not* to break that stuff up into multiple lines. Of course, there are many broken email clients out there (shocking, I know, but true) so you also want to provide the link without the <link> bits for those clients. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#203266) next »