note 57233 added to ref.array

From: Date: Tue, 27 Sep 2005 20:57:44 +0000
Subject: note 57233 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-95898@lists.php.net to get a copy of this message
<?php function array_move_by_value ($array, $tbl, $position, $value){ foreach ($array[$tbl] as $key => $val) { if ($val == $value){ if ($key == $position) return $array; $array[$tbl][$key] = $array[$tbl][$position]; $array[$tbl][$position] = $value; return $array; } } } $test_array = array('test' => array( 'arr1', 'arr2', 'arr3' ), ); $test_array = array_move_by_value( $test_array, 'test', '0','arr3' ); print_r ($test_array); ?> ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57233 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57233&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57233&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95898) next »