2009-02-26 8 views

Antwort

29

Schnell Spickzettel Wenn Sie nicht vertraut mit dem Jargon sind, ist hier eine schnelle Übersetzung von alternativen Begriffe, die möglicherweise einfacher merken:

* array_unshift() - (aka Prepend ;; InsertBefore ;; InsertAtBegin)  
* array_shift() - (aka UnPrepend ;; RemoveBefore ;; RemoveFromBegin) 

* array_push()  - (aka Append ;; InsertAfter ;; InsertAtEnd)  
* array_pop()  - (aka UnAppend ;; RemoveAfter ;; RemoveFromEnd) 
+0

groß man in der Tat :) –

0

Für mich array_slice() funktioniert gut, Sprich:

$arr = array(1,2,3,4,5,6); 
//array_slice($array,offset); where $array is the array to be sliced, and offset is the number of array elements to be sliced 
$arr2 = array_slice($arr,3);//or 
$arr2 = array_slice($arr,-3);//or 
$arr2 = array_slice($arr,-3,3);//return 4,5 and 6 in a new array 
$arr2 = array_slice($arr,0,4);//returns 1,2,3 and 4 in a new array 
+0

warum nicht j ust array_shift() ist so viel effektiver? –

Verwandte Themen