by Anonymous » 01 Feb 2025, 10:03
Ich habe eine Reihe von Produkten und möchte sie mit einem anderen Array sortieren. < /p>
$products = array(
0 => 'Pro 1',
1 => 'Pro 2',
2 => 'Pro 3'
);
$sort = array(1,2,0);
array_multisort($products, $sort);
< /code>
Array sollte < /strong> jetzt sein ... < /p>
$products = array(
0 => 'Pro 2',
1 => 'Pro 3',
2 => 'Pro 1'
);
< /code>
Ich scheine Array_Multisort nicht richtig zu verwenden. Ich habe jetzt seit 2 Stunden unterschiedliche Wege ausprobiert ...
Ich habe eine Reihe von Produkten und möchte sie mit einem anderen Array sortieren. < /p>
$products = array(
0 => 'Pro 1',
1 => 'Pro 2',
2 => 'Pro 3'
);
$sort = array(1,2,0);
array_multisort($products, $sort);
< /code>
Array sollte < /strong> jetzt sein ... < /p>
$products = array(
0 => 'Pro 2',
1 => 'Pro 3',
2 => 'Pro 1'
);
< /code>
Ich scheine Array_Multisort nicht richtig zu verwenden. Ich habe jetzt seit 2 Stunden unterschiedliche Wege ausprobiert ...