How can array elements be moved to specific positions in PHP?

To move array elements to specific positions in PHP, you can use the `array_splice()` function. This function allows you to remove elements from an array and insert new elements at the specified positions. By specifying the starting index and the number of elements to remove, you can effectively move elements within the array.

$array = [1, 2, 3, 4, 5];
$element = $array[2]; // Element to move
$index = 0; // New position index
array_splice($array, 2, 1); // Remove element from current position
array_splice($array, $index, 0, $element); // Insert element at new position
print_r($array); // Output: [3, 1, 2, 4, 5]