News for hackers. Stuff that matters.
Re:We will try to stop fixing bugs in PHP by TylerE on Friday June 22, 2012 @12:02AM (#4145321)
I disagree with point A. The old behavior makes a LOT more sense symbolically.

I tell you that you have no apples. Write the number of apples you have on a piece of paper. What did you write? I bet it was 0, not some arbitrary, non-writable symbol for an abstract concept that could mean "nothing" or "error" or "empty" or ..

Re:We will try to stop fixing bugs in PHP by steve8918 on Friday June 22, 2012 @12:11AM (#4145350)
I don't agree with your analogy. The question is more similar to "Can you please tell me the number format of <silence>".

How can the answer to an unfinished question be "0"? 0 is an actual valid answer, when people are asking for number_format(0, 0).

In this case, NULL is definitely more appropriate, because the input is invalid.

Re:We will try to stop fixing bugs in PHP by masklinn on Friday June 22, 2012 @02:34AM (#4145734)
> he question is more similar to "Can you please tell me the number format of <silence>".

Well in PHP, the number for <silence> is 0, so it would stand to reason that the formatted number for <silence> is 0 as well.

Re:We will try to stop fixing bugs in PHP by ivix on Friday June 22, 2012 @05:41AM (#4146100)
Of course, in a more sane language, it would throw an exception, rather than silently returning a wrong value.
Re:We will try to stop fixing bugs in PHP by phene on Friday June 22, 2012 @12:23AM (#4145390)
What's the numeric representation of the volume of <silence>? 0 dB
Re:We will try to stop fixing bugs in PHP by mturmon on Friday June 22, 2012 @01:13AM (#4145519)
Since dB are a log scale, more properly, it would be -Inf dB.
Re:We will try to stop fixing bugs in PHP by exDM69 on Friday June 22, 2012 @09:28AM (#4146669)
0 dB = atmospheric pressure. -Inf dB = vacuum of space.
Re:We will try to stop fixing bugs in PHP by dpark on Friday June 22, 2012 @01:02AM (#4145491)
So you make up a different question to fit the answer you want? Actually that seems about right for PHP.
Re:We will try to stop fixing bugs in PHP by felipellrocha on Friday June 22, 2012 @12:32AM (#4145416)
I think you missed the point here. Steve's analogy asks for a number format, not a volume...
Re:We will try to stop fixing bugs in PHP by MBlume on Friday June 22, 2012 @12:44AM (#4145440)
Downvoted for cleverness.
Re:We will try to stop fixing bugs in PHP by chavesn on Friday June 22, 2012 @12:27AM (#4145401)
I agree with Steve. "No apples" actually is "0 apples".

Your analogy is a misunderstanding of null. Null is like you asking me how many apples Joe has. I say I don't know. If you write down 0, I'm going to stop you and say, "I didn't say zero, I said I don't know."

Re:We will try to stop fixing bugs in PHP by Too on Friday June 22, 2012 @01:09AM (#4145512)
BOTH behaviors don't make sense. The right behavior is to throw an exception.
Re:We will try to stop fixing bugs in PHP by enjo on Friday June 22, 2012 @01:45AM (#4145585)
Absolutely agree, and that's PHP's biggest issue. It is constantly doing things like this instead of simply complaining and stopping things down like any sane system would.

If I were in charge of PHP, release 6 would be 5.4.4 with the standard library happily throwing exceptions on invalid input. That's it. The language would be 100% more useful instantly.

Re:We will try to stop fixing bugs in PHP by eitland on Friday June 22, 2012 @01:59AM (#4145635)
As mentioned to parent: then you'd have a lot of work to do to clean up one even more widely used language : )
Re:We will try to stop fixing bugs in PHP by gbog on Friday June 22, 2012 @10:30AM (#4146861)
You mean JavaScript, right? Reading this conversation I was wondering how no comment would point at the same or bigger similar issues in JavaScript.
Re:We will try to stop fixing bugs in PHP by eitland on Friday June 22, 2012 @01:57AM (#4145629)
This depends on language. Or you'd have to dismiss at least on widely used systems programming language as well. : )
Re:We will try to stop fixing bugs in PHP by Too on Friday June 22, 2012 @12:16PM (#4147408)
Well...if we are allowed to change language completely we could change to a type safe language (as most systems programming are) and we wouldn't have this discussion in the first place since it would be impossible to call the function with a string parameter...
Re:We will try to stop fixing bugs in PHP by jeffdavis on Friday June 22, 2012 @12:53AM (#4145463)
I tell you that you have "foo" apples. Write the number of apples you have on a piece of paper. What did you write?
Re:We will try to stop fixing bugs in PHP by pelotom on Friday June 22, 2012 @01:10AM (#4145513)
I tell you you have 12/0 apples. Write the number of apples you have on a piece of paper. Some "functions" are not defined for all inputs. Better to give a "that doesn't make sense" answer than a bogus answer.