Ds\Map::toArray() 函數可以將Map轉換為數組。
用法
public array Ds\Map::toArray( void )
Ds\Map::toArray() 函數沒有任何參數。
Ds\Map::toArray() 函數可以返回一個數組,其中包含與映射相同順序的所有值。
例子1
<?php
$map = new \Ds\Map([1 => 10, 2 => 20, 3 => 30, 4 => 40]);
print_r($map->toArray());
?>
例子2
<?php
$map = new \Ds\Map(["first" => "Tutorials", "second" => "Point", "third" => "Indaa"]);
print_r($map->toArray());
?>
相關用法
- PHP Ds Map last()用法及代碼示例
- PHP Ds Map first()用法及代碼示例
- PHP Ds Map apply()用法及代碼示例
- PHP Ds Map filter()用法及代碼示例
- PHP Ds Map reduce()用法及代碼示例
- PHP Ds Map keys()用法及代碼示例
- PHP Ds Map union()用法及代碼示例
- PHP Ds Map put()用法及代碼示例
- PHP Ds Map diff()用法及代碼示例
- PHP Ds Map count()用法及代碼示例
- PHP Ds Map merge()用法及代碼示例
- PHP Ds Map sort()用法及代碼示例
- PHP Ds Map values()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - Ds Map toArray() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。