Ds\Deque::rotate

(PECL ds >= 1.0.0)

Ds\Deque::rotateRotates the deque by a given number of rotations

Beschreibung

public Ds\Deque::rotate(int $rotations): void

Rotates the deque by a given number of rotations, which is equivalent to successively calling $deque->push($deque->shift()) if the number of rotations is positive, or $deque->unshift($deque->pop()) if negative.

Parameter-Liste

rotations

The number of times the deque should be rotated.

Rückgabewerte

Es wird kein Wert zurückgegeben.. The deque of the current instance will be rotated.

Beispiele

Beispiel #1 Ds\Deque::rotate() example

<?php
$deque 
= new \Ds\Deque(["a""b""c""d"]);

$deque->rotate(1);  // "a" is shifted, then pushed.
print_r($deque);

$deque->rotate(2);  // "b" and "c" are both shifted, the pushed.
print_r($deque);
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

(
    [0] => b
    [1] => c
    [2] => d
    [3] => a
)
Ds\Deque Object
(
    [0] => d
    [1] => a
    [2] => b
    [3] => c
)

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

2024 Suns Participant Critique: Damion Lee. Gentleman, he can waive a towel!

Enable us toward introduce yet another contemporary contributor in direction of Vivid Aspect, and our minute in opposition to throughout the Pacif ...

Geschrieben von RyanDunn am 28.11.2025 02:20:45
Forum: ASP, PERL, CGI, C und alles andere
Who would the Suns address within an Advancement Draft?

I'm 's July, and enable me inform on your own, it's Really just about anything out below inside the , the thermometer virtually burst at 118 withi ...

Geschrieben von RyanDunn am 28.11.2025 02:19:30
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS
In spite of suspension, Miamis Thomas Bryant can order his championship

DENVERhe NBA will let suspended Miami Warm heart Thomas Bryant in direction of quickly be in just Denver's arena Thursday evening hence he can get ...

Geschrieben von RyanDunn am 28.11.2025 02:18:52
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS
3 a long time in the past presently, the Cincinnati Bengals drafted

Upon this day, a few yrs in the past, the Cincinnati Bengals retained the initially in general select within the 2020 NFL of we dive into it, let ...

Geschrieben von RyanDunn am 28.11.2025 02:18:01
Forum: SQL / Datenbanken