Re: PHP Complex Data Structures
| From: | Jason Barnett | Date: | Tue, 17 May 2005 21:15:30 +0000 |
| Subject: | Re: PHP Complex Data Structures | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215413@lists.php.net to get a copy of this message | ||
Zzapper wrote:
Hi, I seem to remember that you access/use PHP data in the same/similar way to Perl data and that you can create complex data structures ie arrays of arrays, arrays of records etc. For once Google let me down so can any one point at any doc info. <?phpclass A { } /** Initialize the array with values */ $stack = array(1,2,3); /** Push an array on the stack */ $stack[] = array('a', '2nd dimension of array'); /** Now we show that we can push an object onto the array */ $obj = new A(); /** The & might be recommended if you're using PHP4 */ $stack[] = &$obj; $obj->testvar = TRUE; /** Now we look at the stack */ echo '<pre>'; var_dump($stack); echo '</pre>'; ?>