Kartenwerte von einem flachen Array zu einem anderen flachen ArrayPhp

PHP-Programmierer chatten hier
Anonymous
 Kartenwerte von einem flachen Array zu einem anderen flachen Array

Post by 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 ...

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post