Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Initializing a dynamic array


Message #1 by "arun" <arun@l...> on Wed, 24 Jul 2002 16:49:00 +0530
You can just initialise them as arrays:


			      var $RowStyle = array();
 					var $ColStyle = array();

Then just use them as you need to:

$RowStyle[0] = 'aaa';
$ColStyle[0][0] = 'bbb';
$ColStyle[0][1] = 'ccc';
$ColStyle[1][0] = 'ddd';
$ColStyle[1][1] = 'eee';

or perhaps:

$ColStyle[0] = array ('bbb', 'ccc');
$ColStyle[1] = array ('ddd', 'eee');

or perhaps:

$ColStyle = array (
	array ('bbb', 'ccc'),
	array ('ddd', 'eee')
);

-- CS



On Wed, 24 Jul 2002, arun wrote:

> Hi,
>
> I need to initialize a dynamic array in php. If i declare it like
>
> 				      var $RowStyle[]; // One Dim array
> 					var $ColStyle[][]; // Two Dim array
>
> It is giving parser error.
> Can any one help me out of this..
>
> with regards,
> arun
>
>
>


  Return to Index