Re: Order of implode() params insignificant?
| From: | Joe Stump | Date: | Wed, 29 Nov 2000 23:22:11 +0000 |
| Subject: | Re: Order of implode() params insignificant? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27922@lists.php.net to get a copy of this message | ||
That's odd - for good reason I stick to the definition in the manual - those
are the types of things that get "fixed" without warning.
--Joe
On Wed, Nov 29, 2000 at 03:08:51PM -0800, Paul Mullen wrote:
> An quirk in Rasmus Lerdorf's ORA PHP Pocket Reference [1] led me to the
> discovery [2] that the order of the parameters used when calling either
> implode() or join() seems to be inconsequential. That is, the functions
> may be called with the parameters as ($src, $glue) or ($glue, $src), and
> work fine in either case. Was this purposeful on the part of the PHP
> developers?
>
> Paul
>
>
> [1] The order of the parameters listed for the implode() function were
> the reverse of those specified for the join() function, even though the
> online docs claim that, join() an alias of sorts for implode(), they are
> identical in their behavior.
>
> [2] I ran the following script as an experiment:
>
> <?PHP
>
>
> $src = array( "This", "is", "a", "test" );
> $glue = '-';
>
> $joined_glue_src = join( $glue, $src );
> $joined_src_glue = join( $src, $glue );
>
> $imploded_glue_src = implode( $glue, $src );
> $imploded_src_glue = implode( $src, $glue );
>
> echo<<<OUTPUT
> join( glue, src ) = $joined_glue_src<br>
> join( src, glue ) = $joined_src_glue<br>
> <br>
> implode( glue, src ) = $imploded_glue_src<br>
> implode( src, glue ) = $imploded_src_glue<br>
> OUTPUT;
>
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
================================================================================
= Joe Stump joestump98@yahoo.com http://www.miester.org =
================================================================================
Need a programmer? http://www.google.com/search?q=%22Joe+Stump%22