Possible PHP bug: echo affecting if statement

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

krot
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Apr 20, 2013 4:00 pm

Possible PHP bug: echo affecting if statement

Postby krot » Sat Apr 20, 2013 4:19 pm

Hi:
I have the following code (PHP 5.3.3-7 squeeze 15):

goto a:
(code here - well tested - not an issue)
a:
echo "FIRST QN: type_no: ".$type_no."; subtype_no: ".$subtype_no."; qn_no: ".$qn_no."<br /";
echo "<br />";
IF (($type_no != 1) OR ($subtype_no != 1) OR ($qn_no != 1)) {
(code here - well tested - not an issue)
}

When I remove the echo "<br />"; then the script halts after printing echo "FIRST QN .....".
Is this a bug in PHP? Anyone else finding this?

Thanks.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Possible PHP bug: echo affecting if statement

Postby johnj » Sat Apr 20, 2013 10:41 pm

How did you conclude that the script halts after printing "FIRST QN" ??

Please put an echo statement both inside the if ($type_no !=1 ...) and outside and then decide if the script is really halting without checking the "IF" condition.

krot
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Apr 20, 2013 4:00 pm

Re: Possible PHP bug: echo affecting if statement

Postby krot » Sun Apr 21, 2013 4:19 am

Thanks for replying johnj.
I have the following echo after the if true, and the second one after the if false:

echo "Why not printing here? ";

echo "NEXT QN: type_no: ".$type_no."; subtype_no: ".$subtype_no."; qn_no: ".$qn_no."<br /";

krot
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Apr 20, 2013 4:00 pm

Re: Possible PHP bug: echo affecting if statement

Postby krot » Sun Apr 21, 2013 4:34 am

Oooh! Egg on my face ..
I just noticed that the <br /> didn't have the > sign there. It works just fine now.
Sorry for wasting your time johnj.
Have a good day!


Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], markymark and 1 guest

cron