php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9319 join function joins in reverse order in one specific instance.
Submitted: 2001-02-17 12:02 UTC Modified: 2001-02-25 05:57 UTC
From: nick at neikos dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.4 OS: Linux kernel 2.4.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nick at neikos dot com
New email:
PHP Version: OS:

 

 [2001-02-17 12:02 UTC] nick at neikos dot com
	$arr1 = array("dog","cat","bird","fish");
	echo join(" = ",$arr1);

	echo "<br>";

	$arr2[0] = "dog";
	$arr2[1] = "cat";
	$arr2[2] = "bird";
	$arr2[3] = "fish";
	echo join(" = ",$arr2);

	echo "<br>";

	list($arr3[0],$arr3[1],$arr3[2],$arr3[3]) = array("dog","cat","bird","fish");
	echo join(" = ",$arr3);

// This last join will join in the reverse order.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-24 14:08 UTC] jmoore@php.net
Verified under win2k 4.0.5-dev

This might be the expected behaviour but it is also undesirable. I cant think of a nice way of implmenting a fix due to the fact adding a sort to sort the keys will break lots of peoples scripts. Perhaps just tell the end user to ksort first although I feel arrays with numeric keys should probably join them in order?

James

 [2001-02-25 05:57 UTC] jmoore@php.net
This is the expected behaviour and wont be changed anytime soon due to breaking too many scripts if we do. Please use ksort() if you really need to do this.

James
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC