remove the element from with key array in php code example
Example 1: php remove element from array
$arr = array('a' => 1, 'b' => 2, 'c' => 3);
unset($arr['b']);
// RESULT: array('a' => 1, 'c' => 3)
$arr = array(1, 2, 3);
array_splice($arr, 1, 1);
// RESULT: array(0 => 1, 1 => 3)
Example 2: remove key of an array php
$result_Member = $this->Member->get_list_member_belong_to_company($id);
/*
$result_Member = array(
[10] => 10,
[20] => 11,
[30] => 12,
)
*/
// remove key, get values only
$member_ids = array_values($result_Member);
/*
$result_Member = array(
[0] => 10,
[1] => 11,
[2] => 12,
)
*/