Hi!

Let me turn your question around: Why on earth would someone restrict a function to int when string works just as well?

function int foo_flexible(scalar $x) { return $x + 42; }
$foo = foo_flexible($value);

Now let's think - what happens if $x is *not* scalar? So the real code would be like this:

function foo_flexible(scalar $x) { return $x + 42; }
if(!is_scalar($value)) {
  $foo = foo_flexible($value);
} else {
// ok, what do I do now?
}

And so for each instance. Ugly.

That said, I'll be using
function foo($x) { return $x + 42; }
anyway and let PHP warnings take care of the rest ;-)

Amen to that.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to