/ LJCPHPCodeDoc / LJCGenTextSectionLib / LJCSections / 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/LJCGenTextSectionLib.php";
 
 $sections = new LJCSections();
 $key = "SectionName";
 if ($sections->HasKey($key))
 {
   throw new Exception("Key: {$key} already in use.");
 }
 else
 {
   $section = new LJCSection($key);
 }

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