Bug #16119: Swapping two elements of an array
| From: | joho at webbplatsen dot se | Date: | Sat, 16 Mar 2002 23:52:05 +0000 |
| Subject: | Bug #16119: Swapping two elements of an array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-2663@lists.php.net to get a copy of this message | ||
From: joho@webbplatsen.se
Operating system: All
PHP version: 4.1.2
PHP Bug Type: Feature/Change Request
Bug description: Swapping two elements of an array
I must be getting old, but I cannot seem to find a function that swaps the
data of two array entries. Like so:
$ar[0] = "second";
$ar[1] = "first";
array_swap ($ar, 0, 1);
I have not overlooked the sort functions, that is not what I am after. But
I may have overlooked other possibilities. Searching for "swap" in the PHP
.CHM (fairly recent) yielded no hits.
--
Edit bug report at http://bugs.php.net/?id=16119&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16119&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16119&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16119&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16119&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16119&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16119&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16119&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16119&r=submittedtwice