Informática Asociada ia doc & examples Index Examples List

Documentation jit ia\Lib\iaArray Documentation Function examples Index Examples List

class ia\Lib\iaArray


Index Documentation Function examples Index Examples List

ia\Lib\iaArray


Examples by function ia\Lib\iaArray Documentation Function examples Index Examples List

ia\Lib\iaArray

Disclaimer: Auto generated file. Please help us setting parameters to useful values and extending the examples.

  • ia\Lib\iaArray::array_key_exists_insensitive(string $key $key, array $array) : bool
    /**
         * array_key_exists case insensitive
         *
         * @param string $key key to search for case insensitive
         * @param array $array
         * @return bool true key exists, false dosen't exist
         */
    
    1. ia\Lib\iaArray::array_key_exists_insensitive('asdf', ['a' => '1', 'b' => '2', 'c' => 3]); -> false
  • ia\Lib\iaArray::get_key_insensitive(string $key, array $array, mixed $notFound = null) : mixed
    /**
         *  $array[$case_insensitive_key]
         *
         * @param array $array
         * @param string $key
         * @param mixed $notFound
         * @return mixed
         */
    
    1. ia\Lib\iaArray::get_key_insensitive('asdf', ['a' => '1', 'b' => '2', 'c' => 3]); -> 
  • ia\Lib\iaArray::array_key_n(array $array, int $keyPosition, string $default = null) : string
    /**
         * return array's key at position $keyPosition
         *
         * @param array $array
         * @param int $keyPosition
         * @param string $default
         * @return string
         */
    
    1. ia\Lib\iaArray::array_key_n(['a' => '1', 'b' => '2', 'c' => 3], 3); -> 
  • ia\Lib\iaArray::change_array_keys(array $Data, array $keyMap, bool $includeNonMappedKeys = true) : array
    /**
         * Change array keys
         *
         * @param array $Data
         * @param array $keyMap ['keyIn $Data' => 'newKey']
         * @param bool $includeNonMappedKeys true keys not in $keyMap are
         * @return array changes de keys in $Data for those in $keyMap, not found are controled by $includeNonMappedKeys
         * @exmpale reKey(['kB'=>'kB val','kA'=>'kA val','other'=>'other val'],['kA'=>'A','kB'=>'B'],true) ['kB'=>'kB val','kA'=>'kA val','other'=>'other val']
         * @exmpale reKey(['kB'=>'kB val','kA'=>'kA val','other'=>'other val'],['kA'=>'A','kB'=>'B'],false) ['kB'=>'kB val','kA'=>'kA val']
         */
    
    1. ia\Lib\iaArray::change_array_keys(['a' => '1', 'b' => '2', 'c' => 3], ['a' => '1', 'b' => '2', 'c' => 3]); -> 
      Array
      (
          [1] => 1
          [2] => 2
          [3] => 3
      )
      
  • ia\Lib\iaArray::compare( $a, $b) :
    
                    
    1. ia\Lib\iaArray::compare(null /* == */, null /* == */); -> 
      0
  • ia\Lib\iaArray::array_changes(array $after, array $before) : array
    /**
         * Retrun an array with what changed or added in $after vs $before
         *
         * @param array $after
         * @param array $before
         * @return array
         */
    
    1. ia\Lib\iaArray::array_changes(['a' => '1', 'b' => '2', 'c' => 3], ['a' => '1', 'b' => '2', 'c' => 3]); -> 
      Array
      (
      )
      
  • ia\Lib\iaArray::arrayExtend(array &$base, array $extendWith) : void
    /**
         * Recursevely adds/replaces keys in $base with keys in $extendWith
         *
         * @param array $base ie: ['a'=>'OriA','b'=>'OnlyB','d'=>['d1'=>1]]
         * @param array $extendWith ie: ['c'=>'NewC', 'a'=>'Replaced', 'd'=>['d2'=>2]]
         * @return void $base is modified ie:  [['a'] => 'Replaced', ['b'] => 'OnlyB', ['d'] => [ ['d1'] => 1, ['d2'] => 2 ], [c] => 'NewC']
         */
    
    1. ia\Lib\iaArray::arrayExtend(['a' => '1', 'b' => '2', 'c' => 3], ['a' => '1', 'b' => '2', 'c' => 3]);"
  • ia\Lib\iaArray::expandKeyToArray(array $array, string $separator) : array
    /**
         *
         *
         * @param array $array
         * @param string $separator
         * @return array
         */
    
    1. ia\Lib\iaArray::expandKeyToArray(['a' => '1', 'b' => '2', 'c' => 3], 'asdf'); -> 
      Array
      (
          [a] => 1
          [b] => 2
          [c] => 3
      )
      
  • ia\Lib\iaArray::tupplesToArrayAssoc(array $list) : array
    /**
         * Keys to final value
         *
         * @param array $list ie [ ['vivo','animal','felino','gato', 'domestico','gato info'], ['vivo','animal','felino','gato', 'feral','salvaje'], ['vivo','animal','canino','perro','Perro Frase'] ]
         * @return array ie [ 'vivo' => ['animal' => ['felino' => [ 'gato' => [ 'domestico' => 'gato info' , 'feral' => 'salvaje' ] ], 'canino' => ['perro' => 'Perro Frase' ] ] ]]
         */
    
    1. ia\Lib\iaArray::tupplesToArrayAssoc(['a' => '1', 'b' => '2', 'c' => 3]); -> 

      Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /lamp/www/iaLib/inc_ia/Lib/iaArray.php:177 Stack trace: #0 /lamp/www/iaLib/inc_ia/Lib/iaArray.php(177): count('1') #1 /lamp/www/iaLib/ia_examples/code/ia/Lib/iaArray_example_code.php(197): ia\Lib\iaArray::tupplesToArrayAssoc(Array) #2 /lamp/www/iaLib/ia_examples/template/ia_example_class.php(118): include('/lamp/www/iaLib...') #3 /lamp/www/iaLib/ia_examples/ia/Lib/iaArray_example.php(9): include('/lamp/www/iaLib...') #4 /lamp/www/iaLib/ia_examples/showDoc.php(24): include('/lamp/www/iaLib...') #5 {main} thrown in /lamp/www/iaLib/inc_ia/Lib/iaArray.php on line 177