RE: [PHP] arrays as object properties
| From: | Mike Heath | Date: | Wed, 25 Oct 2000 20:47:33 +0000 |
| Subject: | RE: [PHP] arrays as object properties | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21927@lists.php.net to get a copy of this message | ||
Well I don't think putting global $parts is a very reasonable solution. It
certainly isn't modular.
Rebecca, what version of PHP are you using? I'd recommend using at least
PHP 4.0.2pl2 (or PHP 4.0.3pl1 since it is the latest). It fixed some bugs
with arrays in classes. We were having similar problems but the problems
cleared up after upgrading.
Hope that can help,
Mike
-----Original Message-----
From: Mulcahy, Chris [mailto:cmulcahy@vivius.com]
Sent: Wednesday, October 25, 2000 12:15 PM
To: 'php-general@lists.php.net'
Subject: RE: [PHP] arrays as object properties
Try putting global $parts in your init function.
Hope that helps.
Chris Mulcahy
-----Original Message-----
From: Rebecca [mailto:rebecca@digitalpulp.com]
Sent: Monday, October 23, 2000 12:29 PM
To: php-general@lists.php.net
Subject: [PHP] arrays as object properties
so if i have:
class car {
var $parts;
function init($new_parts) {
$this->parts = $new_parts;
}
}
how can i make this work:
$parts = array("radio","four_w_drive","mats","si");
$car = new car;
//the following peice of code is the trouble......i can't seem to make an
object property an array....
$car->init($parts);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net