Exchanges two items in an array

@param array &$arr The array
@param int   $i    The index of the first item
@param int   $j    The index of the second item

@return void
489696
protected static function exch(array &$arr, int $i, int $j): void
    {
        $temp = $arr[$i];
        $arr[$i] = $arr[$j];
        $arr[$j] = $temp;
    }
835705
protected boolean joinWithComparator(int i, int j) {
        if (comparator.compare(array[j], array[i]) < 0) {
            K tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
            reverse.flip(j);
            return false;
        }
        return true;
    }
1088069
function ajouter($elem){
		echo "ajouter";
		
		if(is_array($elem)){
			foreach ($elem as $e){
				$array_messages[] =$e;
			}
		}
		else
		{
			$array_messages[]   = $elem;
		}
		
	}
40915
private function ins(&$ary, $keys, $val) 
    {
        $keys ? 
            $this->ins($ary[array_shift($keys)], $keys, $val) :
            $ary = $val;
    }
813598
public static <T> void swap(T[] arr, int a, int b) {
		if (a < 0 || a > arr.length || b < 0 || b > arr.length)
			throw new IllegalArgumentException("swap position out of bounds.");
		if (a != b) {
			T t = arr[a];
			arr[a] = arr[b];
			arr[b] = t;
		}
	}
1173208
public void swapColumns(int i, int j) {
        if (i != j) {
            Vector ii = getColumn(i);
            Vector jj = getColumn(j);

            setColumn(i, jj);
            setColumn(j, ii);
        }
    }
975136
protected static function swap( &$array, $pos1, $pos2 )
	{
		if( isset( $array[$pos1] ) && isset( $array[$pos2] ) )
		{
			$memory	= $array[$pos1];
			$array[$pos1] = $array[$pos2];
			$array[$pos2] = $memory;
		}
	}
669288
public static void swap(int[] x, int i, int j) {
        int s = x[i];
        x[i] = x[j];
        x[j] = s;
    }
1117301
public void swap(int i, int j) {
    checkBounds(i);
    checkBounds(j);

    if (i == j)
      return;

    copier.copy(tmp, offset(i));
    unsafe.copyMemory(null, offset(j), null, offset(i), elementSpacing);
    unsafe.copyMemory(tmp, firstFieldOffset, null, offset(j), elementSize);
  }
867042
private static void swap(Object[] arr, int i, int j) {
		Object tmp = arr[i];
		arr[i] = arr[j];
		arr[j] = tmp;
	}
1088944
private static <T> void swapReferences( T[] arr, int idx1, int idx2 )
    {
        T tmp = arr[idx1];
        arr[idx1] = arr[idx2];
        arr[idx2] = tmp;
    }
668267
public static int[] swap(int[] array, int index1, int index2) {
		if (isEmpty(array)) {
			throw new IllegalArgumentException("Number array must not empty !");
		}
		int tmp = array[index1];
		array[index1] = array[index2];
		array[index2] = tmp;
		return array;
	}
172109
public static function array_add(array $arr1, array $arr2)
    {
        $newArr = $arr1 ? $arr1 : [];
        foreach ($arr2 as $key => $value) {
            $newArr[] = $value;
        }
        return $newArr;
    }
718046
function swapValuesInArray (A, i, j) {
  if (i !== j) {
    const tmp = A[i];
    A[i] = A[j];
    A[j] = tmp;
  }
  return A;
}
216008
public static <T extends Comparable<? super T>> void siftUp(T[] arr, int k) {
        while (k > 1 && arr[k/2].compareTo(arr[k]) < 0) {
            swap(arr, k, k/2);
            k = k/2;
        }
    }
1113504
public static void siftUp(int[] arr, int k) {
        while (k > 1 && arr[k/2] < arr[k]) {
            swap(arr, k, k/2);
            k = k/2;
        }
    }
836136
void swap(int element1, int element2) {
		int ar1[] = m_buffer[element1 >> m_blockPower];
		int ar2[] = m_buffer[element2 >> m_blockPower];
		int ind1 = element1 & m_blockMask;
		int ind2 = element2 & m_blockMask;
		for (int i = 0; i < m_stride; i++) {
			int tmp = ar1[ind1 + i];
			ar1[ind1 + i] = ar2[ind2 + i];
			ar2[ind2 + i] = tmp;
		}
	}