Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]; function findIt(array $seq) { $arr = array_count_values($seq); $el = []; foreach($arr as $a){ if($a >= 1 && $a % 2){ $el = $a; } } $res = array_keys(array_filter($arr, $el)); print_r($res); return $res; } print_r(findIt($seq));
Copy Clear