yana

Description
  Class trees
  Index of elements
  Todo List
core
  Classes
    FormCreator
    Index
    Language
    Object
    Plugin
    PluginManager
    Singleton
    SmartTemplate
    SmartView
    Utility
    Yana
database
  Classes
    DbBlob
    DbCreator
    DbDesigner4
    DbExtractor
    DbQuery
    DbQueryParser
    DbServer
    DbStream
    DbStructure
    FileDb
error_reporting
  Classes
    Alert
    Error
    ErrorUtility
    Log
    Message
    Report
    Warning
file_system
  Classes
    DatFile
    Dir
    Executeable
    File
    FileReadonly
    FileSystemResource
    SML
javascript
  Classes
    AjaxRequest
  Functions
    preview
    yanaAddEventListener
    yanaAddIcon
    yanaCheckEmbTags
    yanaCloseAll
    yanaGetCookie
    yanaGetElementsByClassName
    yanaMaxLength
    yanaMenu
    yanaMenuCookie
    yanaSetCookie
mail
  Classes
    FormMailer
    Mailer
plugins
  Classes
    plugin_blog
    plugin_check
    plugin_db_admin
    plugin_db_tools
    plugin_default_library
    plugin_diagnostics
    plugin_guestbook
    plugin_guestbook_admin
    plugin_ipblock
    plugin_ipblock_admin
    plugin_rss
    plugin_rss_admin
    plugin_sdk
    plugin_search
    plugin_search_admin
    plugin_user
    plugin_user_admin
utilities
  Classes
    Brush
    Counter
    Hashtable
    Image
    Microsummary
    RSS
    RSSitem
    String
  Functions
    checkArgumentList
    cloneArray
    dirlist
    qSearchArray
    untaintInput
    XMLencode
vdrive
  Classes
    Registry
    VDrive
zip
  Classes
    PclZip

phpDocumentor v 1.4.0

YANA Framework for PHPDocs For Class Hashtable

### Class Hashtable

#### Description

«utility» Hashtable
This is a static utility class to implement certain operations on hashtables (associative arrays).
Example for usage of the $key parameter:

     Array {
         ID1 => Array {
             ID2 => 'value'
         }
     }

To get the string 'value' from the hashtable above use $key = 'ID1.ID2'
The wildcard '*' may be used to refer to the hashtable as a whole.

- access: public

    Utility
       |
       --Hashtable

##### Method Summary

- array changeCase (array $input, [int|bool $case = CASE_LOWER])
- bool exists (array &$hash, string $key)
- mixed &get (array &$hash, string $key)
- array merge (array $A, array $B)
- bool remove (array &$hash, string $key)
- bool set (array &$hash, string $key, mixed $value)
- bool setByReference (array &$hash, string $key, mixed &$value)
- bool setType (array &$hash, string $key, string $type)

#### Methods

##### Lowercase or uppercase all keys of an associative array

array changeCase (
array $input, [int|bool $case = CASE_LOWER]
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$input | array | input array
$case | int|bool | CASE_UPPER or CASE_LOWER

###### Description:

This is a recursive implementation of the PHP function array_change_key_case(). It takes the same arguments: an array $input to work on and an optional argument $case. The argument $case can be one of two constants: CASE_LOWER and CASE_UPPER, where CASE_LOWER is the default.

- access: public

##### check if an element exists

bool exists (
array &$hash, string $key
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address

###### Description:

Returns bool(false) if the element identified by $key can not be found in the given hashtable or it is NULL. Returns bool(true) otherwise.

- access: public

##### retrieve a value

mixed &get (
array &$hash, string $key
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address

###### Description:

Finds the value identified by $key and returns it. If the value is not found NULL is returned.

- access: public

##### recursively merge two arrays to one

array merge (
array $A, array $B
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
$A | array | base array
$B | array | merge with this array

###### Description:

This function is pretty much the same as the php function "array_merge_recursive" except for the way how duplicate keys are treated. Dupplicate keys get replaced in this implementation rather than being appended.
You may provide two or more arrays to merge.
Example with 2 arrays:

1. $foo = Hashtable::merge(array(0 => 'a', 'a' => 'a'), array(0 => 'b'), 1 => 'c');

Result:

     array (
     0 => 'b',
     'a' => 'a',
     1 => 'c'
     )

Example with 4 arrays:

1. $bar = Hashtable::merge($a1, $a2, $a3, $a4);

Recursive example:

     $a1 = array (
     0 => 1,
     1 => array(
       0 => 1,
       'a' => 'b'
       )
     );
     $b = array (
     1 => array(
       0 => 'c',
       1 => 2,
       )
     );
     2 => 3,

Compute this via:

1. $foobar = Hashtable::merge($a1, $a2);

Result:

     array (
     0 => 1,
     1 => array(
       0 => 'c',
       1 => 2,
       'a' => 'b'
       ),
     2 => 3
     )

- access: public

##### remove an element

bool remove (
array &$hash, string $key
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address

###### Description:

Unsets the element identified by $key in the hashtable. Returns bool(false) if the element does not exist or the key is invalid. Returns bool(true) otherwise.

- access: public

##### set an element to a value

bool set (
array &$hash, string $key, mixed $value
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address
$value | mixed | some new value

###### Description:

Sets the element identified by $key to $value. If the value does not exist it gets inserted. If a previous value existed the value gets updated.
This function returns bool(false) if $key = '*' and $value is not an array - which is: trying overwrite the complete hashtable with a non-array value. It returns bool(true) otherwise.

- see: Hashtable::setByReference()
- access: public
- name: Hashtable::set()

##### set an element by Reference

bool setByReference (
array &$hash, string $key, mixed &$value
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address
&$value | mixed | some new value

###### Description:

Sets the element identified by $key to $value by passing it's reference. If the value does not exist it gets inserted. If a previous value existed the value gets updated.
This function returns bool(false) if $key = '*' and $value is not an array - which is: trying overwrite the complete hashtable with a non-array value. It returns bool(true) otherwise.

- see: Hashtable::set()
- since: 2.8.5
- access: public
- name: Hashtable::setByReference()

##### set the data type of an element

bool setType (
array &$hash, string $key, string $type
)

###### List of parameters:

Name | Type | Description
--- | --- | ---
&$hash | array | associative array
$key | string | address
$type | string | data type

###### Description:

Set the data type of the element identified by $key to $type.
Returns bool(false) if the element is NULL or does not exist, or the $type parameter is invalid. Returns bool(true) otherwise.

- access: public

##### inherited from base classes

Inherited From Utility

- Utility::Utility()

Documentation generated on Sun, 04 Jan 2009 03:49:02 +0100 by phpDocumentor 1.4.0

yana author: Thomas Meyerwww.yanaframework.net