Parameters
$key - The element key.
Returns
True if the key already exists, otherwise false.
Syntax
| PHP |
|
public function HasKey($key): bool
|
Indicates if a key already exists.
Example
| 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");
$value = $names->HasKey(0);
$result = $value ? "true" : "false";
// result:
// true;
}
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.