J
J
Jony13372016-11-23 20:06:04
PHP
Jony1337, 2016-11-23 20:06:04

Unique Array Values ​​- PHP?

Good day. Faced a problem. There is this code:

$input = array(4,71, 72, 73, 74, 66,50,51,49,52,53,54,55,57,59,68,69,70,75,76,77,78,79,80);
  $inputShare= array (72,80,59,4,71);

how to drive all the elements that are not in $inputShare into another array, that is, remove from the first array what is in the second.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
romy4, 2016-11-23
@Jony1337

array_diff

W
WQP, 2016-11-23
@WQP

$result = array_unique(array_merge($input, $inputShare));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question