Re: Strange conversion
| From: | php4 at developersdesk dot com | Date: | Sun, 17 Dec 2000 10:52:15 +0000 |
| Subject: | Re: Strange conversion | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41656@lists.php.net to get a copy of this message | ||
Addressed to: Derick Rethans <d.rethans@jdimedia.nl>
Stanislav Malyshev <stas@zend.com>
php-dev@lists.php.net
** Reply to note from Derick Rethans <d.rethans@jdimedia.nl> Sun, 17 Dec 2000 16:50:15 +0100
>
> Stanislav Malyshev wrote:
> >
> > DR>> I have no problem changing all the functions in strings.c to check if no
> > DR>> array is passed. I simply find it strange that an array is converted to
> >
> > That would be silly thing to do. convert_to_string_ex should be changed,
> > not every function using it. That's the purpose of making functions, after
> > all.
> >
> > DR>> the string "Array", when it is taken as a function parameter. Another
> >
> > That's PHP 3 legacy, I guess.
>
> I can't imagine that anyone relies on this, so I think it could be
> changed without pain. What do you think?
I think I may have used this in PHP. I know I have used it in Perl.
It allows a function to work with either a single string, or a list.
If the content of the incoming variable is 'Array' then you pass it
thru a foreach, or while to handle all the parts - else you handle
the single scalar. Many Perl functions work this way, even the built
in ones.
I admit I am moving away from this idea with PHP, but it seems quite
common in the Perl world, and we have quite a few Perl converts around
here.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com