php is having a function to extract slice of an array.
Find below the syntax of this function array_slice().
$outputarray=array_slice($inputarray,$offset,$length);
Here, the length argument is optional.
If you want to remove first two items from an array, you can use as below,
$arrNames=array_slice($arrNames,2);
We can specify negative number also as the offset. In this case, it will be taken from end of the array.
More Articles...
Popular Posts
- Software Testing Quiz Questions and Answers
- Javascript Quiz Questions and Answers
- MySQL Quiz Questions and Answers
- SEO Your Blog the Easy Way - Guest Post
- SEO (Search Engine Optimization) Quiz Questions and Answers.
- PHP Quiz Questions and Answers
- General Knowledge Quiz Questions and Answers
- HTML Quiz Questions and Answers
- Basic Computer Hardware Quiz Questions and Answer.
- Best Motivational Quotes Book | Kindle eBook and Paperback | Read for FREE with Amazon's Kindle Unlimited

No comments:
Post a Comment