You are here: can i have an array as a class variable? « PHP Programming Language « IT news, forums, messages
can i have an array as a class variable?

Posted by nephish on 11/27/12 11:57

hey there, is this ok?

class MyClass
{
var $start;
var $finish;
function MyClass($start, $finish)
{
$this->start = $start;
$this->finish=$finish,
$this->sensor_array = get_sensor_array();
}
function get_sensor_array
{
so some stuff to populate $this->sensor_array;
return array($this->sensor_array);
}
}

another question i have,
why do i need to declare variables with the var if i can declare them
in the constructor without it ?

just a couple of questions.
if you have read this far, thanks for your time

sk

 

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

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