PHP-Programmierer chatten hier
Anonymous
Kartenwerte von einem flachen Array zu einem anderen flachen Array
Post
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 ...
1738400591
Anonymous
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 ...
0 Replies
4 Views
Last post by Guest
12 Jan 2025, 13:53
0 Replies
13 Views
Last post by Anonymous
04 Feb 2025, 21:41
0 Replies
10 Views
Last post by Guest
27 Jan 2025, 07:28
0 Replies
14 Views
Last post by Anonymous
12 Feb 2025, 05:07
0 Replies
12 Views
Last post by Guest
05 Jan 2025, 08:16