<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Arrays and Array-style COM properties</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="com.examples.foreach.html">For Each</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.com.html">COM</a></div> <div class="up"><a href="com.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="com.examples.arrays" class="section"> <h2 class="title">Arrays and Array-style COM properties</h2> <p class="para"> Many COM objects expose their properties as arrays, or using array-style access. In PHP 4, you may use PHP array syntax to read/write such a property, but only a single dimension is allowed. If you want to read a multi-dimensional property, you could instead make the property access into a function call, with each parameter representing each dimension of the array access, but there is no way to write to such a property. </p> <p class="para"> PHP 5 introduces the following new features to make your life easier: <ul class="itemizedlist"> <li class="listitem"> <p class="para"> 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. </p> </li> <li class="listitem"> <p class="para"> Iterate SafeArrays ("true" arrays) using the <a href="control-structures.foreach.html" class="link">foreach</a> control structure. This works because SafeArrays include information about their size. If an array-style property implements IEnumVariant then you can also use foreach for that property too; take a look at <a href="com.examples.foreach.html" class="xref">For Each</a> for more information on this topic. </p> </li> </ul> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="com.examples.foreach.html">For Each</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.com.html">COM</a></div> <div class="up"><a href="com.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>