• PHP Video Tutorials

PHP - Ds\Stack::toArray() Function



Ds\Stack::toArray() function can convert the stack to an array.

Syntax

public array Ds\Stack::toArray( void )

Ds\Stack::toArray() function doesn't have any parameters.

Ds\Stack::toArray() function can return an array containing all values in the same order as a stack.

Example

<?php 
   $stack = new \Ds\Stack(); 
   $stack->push("Tutorials"); 
   $stack->push("Point"); 
   $stack->push("India"); 
  
   print_r($stack->toArray()); 
   print_r($stack); 
?>
php_function_reference.htm
Advertisements