array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'ds-stack.toarray.php', 1 => 'Ds\\Stack::toArray', 2 => 'Converts the stack to an Array', ), 'up' => array ( 0 => 'class.ds-stack.php', 1 => 'Ds\\Stack', ), 'prev' => array ( 0 => 'ds-stack.push.php', 1 => 'Ds\\Stack::push', ), 'next' => array ( 0 => 'class.ds-queue.php', 1 => 'Ds\\Queue', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/stack/toarray.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Ds\Stack::toArray

(PECL ds >= 1.0.0)

Ds\Stack::toArray Converts the stack to an Array

Beschreibung

public Ds\Stack::toArray(): array

Converts the stack to an Array.

Hinweis:

Casting to an Array is not supported yet.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

An Array containing all the values in the same order as the stack.

Beispiele

Beispiel #1 Ds\Stack::toArray() example

<?php
$stack
= new \Ds\Stack([1, 2, 3]);

var_dump($stack->toArray());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

array(3) {
  [0]=>
  int(3)
  [1]=>
  int(2)
  [2]=>
  int(1)
}