3v4l.org

run code in 300+ PHP versions simultaneously
<?php function start() { $GLOBALS['start'] = microtime(true); } function stop($return=false) { $time = microtime(true) - $GLOBALS['start']; if($return) { return $time; } else { printf("\n\n%.20f seconds\n\n", $time); } } for($i=1; $i<50000; $i++) { $csv[] = ["id"=>$i, "another_id"=>1]; $db[] = ["id"=>$i+10, "another_id"=>1]; } start(); // Get items that are in CSV but not in database $new = array_diff_key(array_column($csv, null, 'id'), array_column($db, null, 'id')); // Get items that are in database but not in CSV $del = array_diff_key(array_column($db, null, 'id'), array_column($csv, null, 'id')); stop();

preferences:
24.01 ms | 407 KiB | 5 Q