php clear array code example

Example 1: clear array php

//To clear array you are able to simply re-instantiate it
$foo = array();

//To clear $foo from the symbol table use
unset($foo);

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,
)
*/

Tags:

Php Example