• PHP Video Tutorials

PHP - Ds Sequence map() Function



Ds\Sequence::map() function can return the result of applying a callback to each value.

Syntax

public abstract Ds\Sequence Ds\Sequence::map( callable $callback )

Ds\Sequence::map() function can return the result of applying a callback function to each value in a sequence.

Example

<?php
   $seq = new \Ds\Vector([1, 2, 3, 4, 5]);

   print_r($seq->map(function($value) { 
      return $value * 2; 
   }));
   print_r($seq);
?>
php_function_reference.htm
Advertisements