Page 1 of 1

Tauschen Sie die Position zweier Array-Werte aus, ohne Schlüssel beizubehalten [Duplikat]

Posted: 24 Dec 2024, 07:44
by Anonymous
Ich habe ein Array:
array(
0 => 'contact',
1 => 'home',
2 => 'projects'
);

und ich muss „Kontakt“ mit „Zuhause“ austauschen, sodass das Array wie folgt aussieht:
array(
0 => 'home',
1 => 'contact',
2 => 'projects'
);

Wie kann ich das mit PHP machen?