![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 359 Pomógł: 12 Dołączył: 16.01.2009 Ostrzeżenie: (0%) ![]() ![]() |
Szukam funkcji, która pobrałaby ostatni element tablicy bez usuwania go, tak jak to robi array_pop. Niestety nie znalazłem jej, a w komentarzach do array_pop znalazłem tylko funkcję podobną, którą mógłbym przerobić na własny użytek:
Cytat sneskid at hotmail dot com 03-Aug-2009 07:22 As already mentioned, array_pop always returns a copy, never a reference, which can be a problem in some cases. Here is a pop function that allows you to get the reference. (keep in mind it will alter the internal pointer of the array)
Cytat I hope the PHP people will make the regular function work with references. Pomyślałem żeby zrobić u siebie implementację takiej funkcji ale nie wiem, czy jest to najbardziej wydajne rozwiązanie? Czy może bardziej opłaca się zrobić coś w stylu poniższego kodu?
-------------------- |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 13.08.2025 - 23:20 |