Im not sure either what you mean. you want to know if a var is an array ?
if (is_array($maybe_array))
if your looking for a way to transverse thought the array, use foreach()
function work_on_array($value, $index)
{
if (is_array($index))
foreach($index as $pos => $val)
$value[$pos] = some_func($value[$pos]);
else
$value[$index] = some_func($value[$index]);
return $value;
}
this what your looking for ?
--
Chris Lee
[EMAIL PROTECTED]
"Dennis Gearon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
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?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]