How can i build a dynamic array as a member of a class??
I have the class SELECT and i want its attribute "VALUES" to be set like an
array.
It is possible??
Array would be built in the constructor of the class.
This is my example:
class Select
{
// ~ options separator ^ value-description
separator
var $values;
var $descs;
function Select($list="")
{
echo $list."<br>";
$options = explode("~",$list);
for($i=0; $i<count($options); $i++)
{
$splitted = explode("^",$options[$i]);
echo $splitted[0]."-".$splitted[1]."<br>";
$this->$values[$i] = $splitted[0];
$this->$descs[$i] = $splitted[1];
echo $this->$values[$i]."-".$this->$descs[$i]."<br><br>";
}
}
$sel = new Select("pera^PERA~banana^BANANA~mela^MELA");
i run the script and the result is:
pera^PERA~banana^BANANA~mela^MELA
pera-PERA
PERA-PERA
banana-BANANA
BANANA-BANANA
mela-MELA
MELA-MELA
... while i am expecting:
pera^PERA~banana^BANANA~mela^MELA
pera-PERA
pera-PERA
banana-BANANA
banana-BANANA
mela-MELA
mela-MELA
can you help me please??
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php