PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $arr = [ 0 => 1, 1 => 2, 2 => 1, 3 => 2, 4 => 8, 5 => 7, 6 => 6, 7 => 6, 8 => 6, 9 => 5, 10 => 8, 11 => 4, 12 => 1, 13 => 1, 14 => 1, 15 => 1 ]; $res = array_slice( // get first 5 values array_unique( // get only unique values array_reverse($arr) //reverse array for get last values ) ,0,5); print_r($res);
Show:  
Copy Clear