Ds \ Map::skip()函數是PHP中的一個內置函數,用於在給定的位置索引處返回該對。
用法:
Ds\Pair public Ds\Map::skip ( int $position )
參數:該函數接受單個參數$position,該參數用於返回從零開始的位置索引。
返回值:它在給定位置返回Ds \ Pair。
以下示例程序旨在說明PHP中的Ds \ Map::skip()函數:
程序1:
<?php
// Declare a new map
$map = new \Ds\Map(["a" => 1, "b" => 3, "c" => 5]);
print_r($map->skip(1));
// Declare another new map
$map = new \Ds\Map(["1" => "Geeks", "2" => "for",
"3" => "Geeks"]);
print_r($map->skip(2));
?>
輸出:
Ds\Pair Object ( [key] => b [value] => 3 ) Ds\Pair Object ( [key] => 3 [value] => Geeks )
程序2:
<?php
// Declare a new map
$map = new \Ds\Map(["Geeks1" => "computer",
"Geeks2" => "science", "Geeks3" => 5, "Geeks4" => 20]);
print_r($map->skip(0));
// Declare another new map
$map = new \Ds\Map(["x" => "A", "y" => "B", "z" => "C"]);
print_r($map->skip(1));
?>
輸出:
Ds\Pair Object ( [key] => Geeks1 [value] => computer ) Ds\Pair Object ( [key] => y [value] => B )
參考: https://www.php.net/manual/en/ds-map.skip.php
相關用法
- CSS text-decoration-skip-ink屬性用法及代碼示例
- d3.js d3.set.has()用法及代碼示例
- d3.js d3.mean()用法及代碼示例
- PHP Ds\Set xor()用法及代碼示例
- p5.js hex()用法及代碼示例
- PHP end()用法及代碼示例
- p5.js str()用法及代碼示例
- d3.js d3.rgb()用法及代碼示例
- p5.js tan()用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- d3.js d3.lab()用法及代碼示例
注:本文由純淨天空篩選整理自R_Raj大神的英文原創作品 PHP | Ds\Map skip() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。