array_slice Php Example - Php

How to use array_slice() function in php?

Snippet Code

Rate this page :
  [ 0 votes]

array_slice() function returns selected parts of an array. In this php code, array_slice() method is used which returns array elements from index 2 to 5. The output of this code is Malayalam, Hindi, Telugu.

<?php $language=array("Tamil","English","Malayalam","Hindi","Telugu"); print_r(array_slice($language , 2 , 5)); ?>


Ask Questions

Ask Question