3v4l.org

run code in 300+ PHP versions simultaneously
<?php function findDupl($arr,$n){ $result_arr = array_count_values(array_column($arr, $n)); foreach ($result_arr as $k => $value){ if(emailValid($k) && $value>1){ $res[$k] = $value; } } return $res; } function emailValid($mail){ // Validate email if (filter_var($mail, FILTER_VALIDATE_EMAIL)) { //echo("$email is a valid email address"); return true; } else { //echo("$email is not a valid email address"); return false; } } function unique_multidim_array($array, $key) { $temp_array = array(); $i = 0; $key_array = array(); foreach($array as $val) { if (!in_array($val[$key], $key_array)) { $key_array[$i] = $val[$key]; if(emailValid($key_array[$i]) ){ $temp_array[$i] = $val; } } $i++; } return array_values($temp_array); } $lista = array( array("Generale","","","","Ospite","","",""),array("Num","Alloggio","Arrivo","Partenza","Intestazione","Telefono","email","Nazione"), array(4388,"Sogno Azzurro - Trilocale Superior (9)","2023-04-06","2023-04-10","TEST PROVA","3484403960","prenotazioni@ibookingelba.com","IT"), array(4435,"Villetta Paradiso","2023-04-07","2023-04-16","TEST PROVA","+41772081329","prenotazioni@ibookingelba.com","CH"), array(4435,"Villetta Paradiso","2023-04-07","2023-04-16","TEST PROVA","+41772081329","preno@ibookingelba.com","CH") ); print_r($lista); echo "*********"; //$materials = array_count_values(array_column($lista, 6)); print_r(findDupl($lista,6)); $arr_duplicati = findDupl($lista,6); $keys = array_keys($arr_duplicati); echo $keys[0]; $val = array_values[0]; echo $val[0];
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => Generale [1] => [2] => [3] => [4] => Ospite [5] => [6] => [7] => ) [1] => Array ( [0] => Num [1] => Alloggio [2] => Arrivo [3] => Partenza [4] => Intestazione [5] => Telefono [6] => email [7] => Nazione ) [2] => Array ( [0] => 4388 [1] => Sogno Azzurro - Trilocale Superior (9) [2] => 2023-04-06 [3] => 2023-04-10 [4] => TEST PROVA [5] => 3484403960 [6] => prenotazioni@ibookingelba.com [7] => IT ) [3] => Array ( [0] => 4435 [1] => Villetta Paradiso [2] => 2023-04-07 [3] => 2023-04-16 [4] => TEST PROVA [5] => +41772081329 [6] => prenotazioni@ibookingelba.com [7] => CH ) [4] => Array ( [0] => 4435 [1] => Villetta Paradiso [2] => 2023-04-07 [3] => 2023-04-16 [4] => TEST PROVA [5] => +41772081329 [6] => preno@ibookingelba.com [7] => CH ) ) *********Array ( [prenotazioni@ibookingelba.com] => 2 ) prenotazioni@ibookingelba.com Fatal error: Uncaught Error: Undefined constant "array_values" in /in/3Oghe:51 Stack trace: #0 {main} thrown in /in/3Oghe on line 51
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.49 ms | 403 KiB | 8 Q