April 13, 2011
php function returning a string with a new line?
Question by Jorge
In my first 3 days in coding my homework. I successfully did it. But when I got to school, my code have a problem. I have an ajax form and some php functions.
Here is an example.
$i = 1
if($i == 1) {
echo "yes";
}
else {
echo "no";
}
The answer in my sample is true. But in my case it’s always false. And I notice the ajax requests that the returned message was
// new line
// new line
yes
// new line
That’s why it’s being false. What is the cause of this? I didn’t put any new line in my code.