<?php
$idx = [[1,10],[2,4],[3,5]];
$x = array_column($idx,0);
$y = array_column($idx,1);
$string_y = '';
$string_x = '';
if(count($x) == count($y)){
$i = 0;
foreach($x as $key => $value){
if ($key === array_key_last($x)) {
$string_y .= $y[$key];
$string_x .= $x[$key];
}else{
$string_y .= $y[$key] . ',';
$string_x .= $x[$key] . ',';
}
}
$sql = "SELECT id, b1, b2 FROM dlt WHERE b1 IN ($string_x) AND b2 IN ($string_y) ORDER BY id DESC LIMIT 1";
echo $sql;
}
preferences:
24.61 ms | 405 KiB | 5 Q