PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
class MyClass{
var $a_myArray=array();
function MyClass(){
$this->a_myArray = array('a','b','c');
}
function getA_MyArray(){ return $this->a_myArray; }
function setA_MyArray($x){ $this->a_myArray=$x; }
}
In my php code I would like to access the array variable like such but am unable.
I don't know what you're trying to accomplish with this code snippet, but if you would like to speed it up by a few fractions of a second I would recommend that you not make a call to the function count() each iteration of the for loop. Instead, you might try storing the same value in a variable and then comparing $x to that variable.
class MyClass{
var $a_myArray=array();
function MyClass(){
$this->a_myArray = array('a','b','c');
}
function getA_MyArray($x){ return $this->a_myArrayї$x]; }
}