Newbie question I guess. I'd like to declare an array as an attribute of a class. Everytime I try to use the declared array, I have a warning saying the attribute is not an array, and the result is of course wrong.
For example
Code: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color]urse wrong.
For exampleCode: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color]gs don't disable BBCode... that's just silly [/color]bute of a class. Everytime I try to use the declared array, I have a warning saying the attribute is not an array, and the result is of course wrong.
For exampleCode: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color] warning saying the attribute is not an array, and the result is of course wrong.
For exampleCode: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>For example
Code: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>For example
Code: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color]tribute of a class. Everytime I try to use the declared array, I have a warning saying the attribute is not an array, and the result is of course wrong.
For exampleCode: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>For example
Code: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color]tion I guess. I'd like to declare an array as an attribute of a class. Everytime I try to use the declared array, I have a warning saying the attribute is not an array, and the result is of course wrong.
For exampleCode: Select all
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color:1a
<?php
class ACLass
{
var $my_array = array() ;
function f1($p)
{
return array_rand($p) ;
}
function f2()
{
return $this->f1($my_array) ;
}
}
?>What's wrong ?
Thanks,
d11wtq | If you're using
Code: Select all
tags don't disable BBCode... that's just silly [/color]