You are here: Re: sytax error, but where? « All PHP « IT news, forums, messages
Re: sytax error, but where?

Posted by Janwillem Borleffs on 10/30/05 14:49

carlton wrote:
> PictureList[] is supposed to be an array of C_PictureList objects,
> not a member of the C_PictureList class.
>

You are defining PictureList in the class, which makes it a class member or
a property at least, regardless of what it contains.

Therefore, you are bounded to some restrictions regarding the syntax. If you
don't want it to be member of the class, but accessible through it, one
option would be to define it as a static variable within a class method:

<?php

class C_PictureList {}

class C_Category {
function accessPictureList($new_value = null) {
static $PictureList = array();
if (is_object($new_value)) {
$PictureList[] = $new_value;
} else {
return $PictureList;
}
}
}

// Set
C_Category::accessPictureList(new C_PictureList);

// Get
print_r(C_Category::accessPictureList());

?>

JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация