/ LJCPHPCodeDoc / LJCCollectionLib / LJCCollectionBase / HasKey


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
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCCollectionLib.php";
 
 // $collection extends LJCCollectionBase
 $key = "KeyName";
 if ($collection->HasKey($key))
 {
   throw new Exception("Key: {$key} already in use.");
 }

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.