PHP Echo Prepending with a Zero?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chodges
Forum Newbie
Posts: 3
Joined: Sat Feb 02, 2008 11:47 am

PHP Echo Prepending with a Zero?

Post by chodges »

Hello:

I'm hoping someone can give me some insight as to why this is happening. Whenever I do an echo in my code and read it from a client side program it ALWAYS prepends the echo with a zero (0).

I'm using PHP version 4.4.4.

Thanks for your help with this.

Chris
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: PHP Echo Prepending with a Zero?

Post by John Cartwright »

That is very odd... example? Code?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: PHP Echo Prepending with a Zero?

Post by califdon »

chodges wrote:Hello:

I'm hoping someone can give me some insight as to why this is happening. Whenever I do an echo in my code and read it from a client side program it ALWAYS prepends the echo with a zero (0).

I'm using PHP version 4.4.4.

Thanks for your help with this.

Chris
Sounds like it would have to be a character encoding issue. What hardware is this running on?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PHP Echo Prepending with a Zero?

Post by Chris Corbyn »

No, it sounds like you're echoing the return value of a function which outputs something:

Code: Select all

function foo() {
  echo "test";
  return 0;
}
 
echo foo(); //0test
EDIT | Meh, I'm wrong, the 0 would follow in my case.
chodges
Forum Newbie
Posts: 3
Joined: Sat Feb 02, 2008 11:47 am

Re: PHP Echo Prepending with a Zero?

Post by chodges »

Thanks for your feedback but the problem is that it is PREPENDING with a zero meaning that if I do something like this:

echo "-1001|";

what I get back is: "0-1001|0"

Can't figure this out for the life of me.

Chris
chodges
Forum Newbie
Posts: 3
Joined: Sat Feb 02, 2008 11:47 am

Re: PHP Echo Prepending with a Zero?

Post by chodges »

Oh also this is running on Linux Intel Hardware Kernel 2.6.17.11-grsechg
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: PHP Echo Prepending with a Zero?

Post by Chris Corbyn »

If you echo two things on the same page, do both echo's have a zero, or just the first? I'm thinking it could be your editor with a UTF-8 character set sending a dodgy BOM.
Post Reply