tags:

views:

26

answers:

1

Hi, I feel this is something to do with my httpd setup for apache. I'm using mod_rewrite if that helps but I think that only effects the url.

It seems when I output some data such as:

$sMessage = 'Error';
echo $sMessage;

It works fine but when I do this:

$sMessage = 'Error';
echo '<p>'+$sMessage+'</p>';

It returns 0. Very odd!

+7  A: 

The string concatenation character in PHP is ., not +. + does a mathematical operation. This should work:

$sMessage = 'Error';
echo '<p>'.$sMessage.'</p>';
Pekka
thanks - I've got too many languages going around my head!
Haraldo
@Haraldo I know how you feel. I get the same problem the other way round :)
Pekka
Yep, JavaScript is complaining about dots all the time :-)
Álvaro G. Vicario