Contents
输出结果
像这样
array(3) { [1]=> string(7) "January" [2]=> string(8) "February" [3]=> string(5) "March" }
程式码
JavaScript
let array = {1: 'January', 2:'February', 3:'March'}; console.log(array);
Perl
use Data::Dumper; my $array = {1 => 'January', 2 => 'February', 3 => 'March'}; print Dumper($array);
PHP
$array = [1 => 'January', 2 => 'February', 3 => 'March']; print var_dump($array);
Python
from pprint import pprint array = {1: 'January', 2:'February', 3:'March'} pprint(array)
Ruby
array = {1 => 'January', 2 => 'February', 3 => 'March'} print array.inspect