PDA

View Full Version : Question about PHP syntax


reub77
10-11-2002, 09:14 PM
I'm converting some ASP into PHP and in one instance of the ASP this is used chr().

This is exactly how it is used:

body = body + "Comments" + chr(13) + Request.Form("Comments") & chr(13)

I suppose chr(13) means 13 spaces. How would one code that in PHP? Does it have something similar?

mordred
10-11-2002, 11:18 PM
I don't know what the chr() function does, but is there any chance that it gives you back the ASCII character identified by the integer as the parameter? Which would result in your case in a carriage return.

So perhaps this is how it looks in PHP:


$body = $body . "Comments" . chr(13) . $_REQUEST['Comments'] . chr(13);


or in a more condensed fashion:


$body .= "Comments\r$_REQUEST[Comments]\r";

reub77
10-12-2002, 01:14 AM
$body .= "Comments\r$_REQUEST[Comments]\r";

You could actually do this I think:

$body .= "Comments: \n $Comments \n";

I think thats the same thing and even shorter.