I want to try to swap the first and last index's of this array:
<?php
$their_name = array(
'Jim' => 'dad',
'Josh' => 'son',
'Jamie' => 'mom',
'Jane' => 'daughter',
'Jill' => 'daughter'
);
?>
So that it will look like this:
<?php
$their_name = array(
'Jill' => 'dad',
'Josh' => 'son',
'Jamie' => 'mom',
'Jane' => 'daughter',
'Jim' => 'daughter'
);
?>
I did something similar last night with an array using these:
$temp = $user_name[0];
$user_name[0] = end($user_name);
$count = count($user_name);
$user_name[$count-1] = $temp;
return $user_name;
I'm assuming that these methodology will be similar. However, $their_name[0] returns 'J'.
Thanks!