working on array of different number of indices
| From: | Dennis Gearon | Date: | Wed, 16 May 2001 15:45:10 +0000 |
| Subject: | working on array of different number of indices | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53056@lists.php.net to get a copy of this message | ||
I want to pass in a scalar int, or an array of ints (indices) to a
function in a class. The scalar or array will be a class variable.
Without knowing the max size of each index, or the number of indices,
(as is required is most other languages), I can't figure out how to
access the array in a flexible fashion. What I **WANT** to use as a
clue is whether the passed $index value is a scalar, or how many
elements are in the array.
examples:
function work_on_array( $value, $index ){
blah to $this->value_s_holder;
..
..
}
work_on_array( 7, array(4,5) );
work_on_array( 23, 1 );
The number of INDICES will not change during program execution, although
I do not want to have to predict the range of the scalar/indices.
any ideas?