PHP Programing language

R4R® PHP
(追記) (追記ここまで)
(追記) (追記ここまで)
array_slice() Function in PHP
(追記) (追記ここまで)
(追記) (追記ここまで)

array_slice()

The array_slice() function returns selected parts of an array.

Syntax:
array_slice(array,start,length,preserve)

In above syntax, "array" specifies an array, "start" specifies the numeric value where the function will start the slice, "length" specifies the length of the returned array and "preserve" specifies if the function should preserve or reset the keys and key values are as follows:

  • true: Preserve keys
  • false - Default. Reset keys
(追記) (追記ここまで)

Example:

<?php
$a=array("Apple","Mango","Orange","Papaya","Banana");
print_r(array_slice($a,1));
?>

Output:

Array ( [0] => Mango [1] => Orange [2] => Papaya [3] => Banana )

(追記) (追記ここまで)
Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /