構文: int public DsSet :: count()
パラメータ:この関数はパラメータを取りません。戻るvalue:この関数は、Setインスタンスに存在する値の数を返します。次のプログラムは、Ds関数/Set :: count():プログラム1を示しています。 <コード><コード><? php
//新しいセットを宣言する
$ set
=
new
DsSet([10、15、21]);
//セット要素を表示
var_dump(
$ set
);
//アイテムの数を表示する
//セットに存在します
echo
"Count is:"
;
print_r(
$ set
->
count
());
?>
Exit: object(DsSet)#1(3){[0] => int(10)[1] => int(15)[2] => int(21)}カウントは次のとおりです:3
プログラム2: <? php
//新しいセットを宣言する
$ set
=
new
DsSet([
"Geeks"
、
"for"
、
"Keegs"
]);
//セット要素を表示
var_dump(
$ set
);
//アイテムの数を表示する
//セットに存在する
echo
"Count is:"
;
print_r(
$ set
->
count
());
?>
終了: object(DsSet)#1(3){[0] => string(5) "Geeks" [1] => string(3) "for "[2] => string(5)" Keegs "}カウントは次のとおりです:3
リンク:http://php.net/manual/en/ds-set。 count.php