PHP 5 + COM + Multidimensional Arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wihlelm Bierbaum

    PHP 5 + COM + Multidimensional Arrays

    I'm trying to make use of a certain method of a COM object that takes a
    multidimensiona l array as its sole parameter.

    Here's an example of the construction of said array:
    $cA = array();
    $cA[$adjNum][0] = new VARIANT($cDesc) ;Type Code
    $cA[$adjNum][1] = new VARIANT($cLongD esc);Long Description
    $cA[$adjNum][2] = new VARIANT('B');
    $cA[$adjNum][3] = new VARIANT($cPrice );
    $cA[$adjNum][4] = new VARIANT('D');
    $cA[$adjNum][5] = new VARIANT($i);

    $result = $awfulComObject->SetAdjustments (new VARIANT($cA), new
    VARIANT('D'));

    The method simply never works out. The COM object on the other end
    always says 'Invalid data array'.

    I've tried all varieties of messing around with this: casting the
    variables in the array to variants (and not doing so), casting the
    array itself to variant (and not doing so)... etc...

    Does anyone have a better way of constructing a multidimensiona l array
    that works with COM in PHP?

    It's rumored that PHP 5 allows for the passing and reading of arrays to
    and from COM objects (http://us2.php.net/com)...

    "PHP 5 introduces the following new features to make your life
    easier: *Access multi-dimensional arrays, or COM properties that
    require multiple parameters using PHP array syntax. You can also write
    or set properties using this technique. "

    Any clues would be very gratefully appreciated -- thanks for reading!

Working...