On Tue, Oct 07, 2003 at 03:18:59PM +0200, Derick Rethans wrote:
> > What is the problem with array_* functions casting implicitely? The vast
> > majority of php functions does implicit casting, array_splice does it,
> > everyone is used to it, PHP is known for it... why go the other way now?
>
> Because it's plain wrong? Array functions should not cast any scalar to
> an array, not even array_splace IMO because a scalar is NOT a non-scalar
> as an array or object.
The same argument works for numbers and strings, imo. They aren't the
same, but there are rules for converting them. Same with Arrays and
non-arrays.

[url]http://de2.php.net/manual/en/language.types.array.php#language.types.array.cast ing[/url]

What is a problem with being able to merge a single element into an
array without having to create an array around it explicitely? What is
wrong with versatility?

> > Btw, this `very, VERY minor change' broke pear.
>
> That has nothing to do with this change, just by a bad design choice.
If a change breaks something in the distribution, i wouldn't call it
minor, no matter what cirstances...
> Once more the description in the manual:
>
> array_merge() merges the elements of two or more arrays together
> so that the values of one are appended to the end of the
> previous one. It returns the resulting array.
I know the description. What does it tell me? String functions tell that
they work on strings, but they accept numbers nonetheless.

This fix does nothing but make PHP more inconsistent.

--
Regards,
Stefan Walk
<swalkprp.physik.tu-darmstadt.de>

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