Reversing Arrays in PHP
Given an array:
<?php
$arr = ['a' => 1, 'b' => 2, 'c' => 3];
?>
Swap the keys and values in it.
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Make the following array from it:
<?php
[5, 4, 3, 2, 1]
?>
Given an array:
<?php
$arr = ['a' => 1, 'b' => 2, 'c' => 3];
?>
Swap the keys and values in it.
Given an array:
<?php
$arr = [1, 2, 3, 4, 5];
?>
Make the following array from it:
<?php
[5, 4, 3, 2, 1]
?>