Common
[ class tree: Common ] [ index: Common ] [ all elements ]

Class: CMNarrays

Source Location: /CMNarrays.php

Class Overview


This class manages PHP arrays objects.


Author(s):

Version:

  • 2.2

Variables

Methods



Class Details

[line 35]
This class manages PHP arrays objects.

Created on 20 aug 07

Changes: 2.1 -> 2.2: 27 jul 09 updated: class has been renamed from Arrays() to CMNarrays() 2.0 -> 2.1: 21 jul 09 added: file is PEAR compatible added: to package Common 1.0 -> 2.0: updated: phpdoc compatible in the way to generate documentation




Tags:

author:  Pierre-Dominique Vienne <pvienne@me.com>
version:  2.2
license:  GNU Public License


[ Top ]


Class Variables

$aInput =

[line 41]

Variable that contains array value to be handled



Tags:

access:  public

Type:   array


[ Top ]

$debug =  false

[line 47]

Variable that contains debug switch



Tags:

access:  public

Type:   bool


[ Top ]

$error =

[line 53]

Variable that contains error return array



Tags:

access:  public

Type:   array


[ Top ]



Class Methods


constructor __construct [line 82]

CMNarrays __construct( [array $aInput = null])

Construction function

This function is used when object is generated. It places $aInput in $this->aInput

  1.  <?php
  2.  $oCMNarrays        new CMNarrays(
  3.       array(
  4.           0   =>  array(
  5.               "rowname"   =>  "value"
  6.           )
  7.       )
  8.  );
  9.  print_r($oCMNarrays->aInput);
  10.  // $this->aInput
  11.  ?>




Tags:

since:  Version 1.0


Parameters:

array   $aInput   array to be treated

[ Top ]

method flattenArray [line 210]

array flattenArray( $array, [ $sPrefix = null])

Array flattener function

This function is used to flatten an array. Result is returned

  1.  <?php
  2.  $array       array(
  3.       "foo1"  =>  "foovalue",
  4.       "aFoo1" =>  array(
  5.           "bar1"  =>  "barvalue",
  6.           "bar2"  =>  "foovalue"
  7.       ),
  8.       "foo2"  =>  "foobar"
  9.  );
  10.  $oCMNarrays     new CMNarrays();
  11.  print_r($oCMNarrays->flattenArray($array);
  12.  // array(
  13.       "foo1"          =>  "foovalue",
  14.       "aFoo1|bar1"    =>  "barvalue",
  15.       "aFoo1|bar2"    =>  "foovalue",
  16.       "foo2"          =>  "foobar"
  17.  )
  18.  ?>




Tags:

return:  treated array
since:  version 2.1
usedby:  WBcollection::renderHTMLresults()


Parameters:

array   $array   array to be processed
   $sPrefix  

[ Top ]

method RemoveColumns [line 125]

array RemoveColumns( $aToremove, array $this->aInput)

Columns removal function

This function is used to remove columns from an array which structure is like MySQL()'s result array. Result is returned

  1.  <?php
  2.  $array   array(
  3.       0   =>  array(
  4.           "foo"   =>  "foovalue",
  5.           "bar"   =>  "barvalue"
  6.       ),
  7.       1   =>  array(
  8.           "foo"   =>  "foovalue",
  9.           "bar"   =>  barvalue"
  10.       )
  11.  );
  12.  $oCMNarrays = new CMNarrays($array);
  13.  print_r($oCMNarrays->RemoveColumns(array("foo"));
  14.  // $array without foo column




Tags:

return:  treated array
since:  version 1.0


Parameters:

array   $this->aInput   array to be processed
   $aToremove  

[ Top ]


Documentation generated on Wed, 26 Aug 2009 12:30:01 +0200 by phpDocumentor 1.4.1