| PHP |
|---|
| public function count(): int |
| PHP |
|---|
// The strongly typed collection class.
class Names extends LJCCollectionBase
{
// Adds a string.
// This method makes a string collection strongly typed.
public function Add(string $text)
{
$retItem = $this->AddItem($text);
return $retItem;
}
}
// Indicates if a key already exists.
private static function HasKey()
{
$names = new Names();
$names->Add("First");
$names->Add("Second");
$names->Add("Third");
$result = count($names);
// result:
// 3;
}
|