Any array function or user defined function to pick up only first occurence of value from the array?
Posted
by OM The Eternity
on Stack Overflow
See other posts from Stack Overflow
or by OM The Eternity
Published on 2010-05-11T13:01:41Z
Indexed on
2010/05/11
13:14 UTC
Read the original article
Hit count: 266
If i have an array
Array
(
[0] => Array
(
[0] => 137
[id] => 137
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => 0
[oldvalue] => 0
[5] => 62
[newvalue] => 62
[6] => checked_out
[field] => checked_out
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:28
[changedone] => 2010-05-11 17:46:28
)
[1] => Array
(
[0] => 138
[id] => 138
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => 0000-00-00 00:00:00
[oldvalue] => 0000-00-00 00:00:00
[5] => 2010-05-11 12:16:28
[newvalue] => 2010-05-11 12:16:28
[6] => checked_out_time
[field] => checked_out_time
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:28
[changedone] => 2010-05-11 17:46:28
)
[2] => Array
(
[0] => 139
[id] => 139
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => Subhash
[oldvalue] => Subhash
[5] => Subhashgfhfgh
[newvalue] => Subhashgfhfgh
[6] => name
[field] => name
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:35
[changedone] => 2010-05-11 17:46:35
)
[3] => Array
(
[0] => 140
[id] => 140
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => subhash
[oldvalue] => subhash
[5] => subhashhfhf
[newvalue] => subhashhfhf
[6] => alias
[field] => alias
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:35
[changedone] => 2010-05-11 17:46:35
)
[4] => Array
(
[0] => 141
[id] => 141
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => 62
[oldvalue] => 62
[5] => 0
[newvalue] => 0
[6] => checked_out
[field] => checked_out
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:35
[changedone] => 2010-05-11 17:46:35
)
[5] => Array
(
[0] => 142
[id] => 142
[1] => 153
[trackid] => 153
[2] => jos_menu
[table_name] => jos_menu
[3] => UPDATE
[operation] => UPDATE
[4] => 2010-05-11 12:16:28
[oldvalue] => 2010-05-11 12:16:28
[5] => 0000-00-00 00:00:00
[newvalue] => 0000-00-00 00:00:00
[6] => checked_out_time
[field] => checked_out_time
[7] => 0
[live] => 0
[8] => 2010-05-11 17:46:35
[changedone] => 2010-05-11 17:46:35
)
)
Now here u can see that the index "field" has repeated values i.e. "checked_out" and "checked_out_time" other indexes have single occurrence, now what should I do to select/grab the first occurrence of the repetitive values only?
© Stack Overflow or respective owner