Array_keys problem
| From: | Robin 'Sparky' Kopetzky | Date: | Sun, 04 Apr 2004 00:12:46 +0000 |
| Subject: | Array_keys problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-182267@lists.php.net to get a copy of this message | ||
Good afternoon.
I'm building a class and am having a bunch of trouble with the PHP
array_keys function. I keep getting these errors:
Warning: First argument to array_keys() should be an array in D:\Htf.php on
line 33
Warning: Wrong datatype for second argument in call to in_array in
D:\Htf.php on line 35
$this->ma_arguments IS an array, so why is the error popping up? I did check
syntax but am buffaloe'd by this one.
Just so no one gets confused, I use a form of Hungarian (p=parameter,
m=module, a=array, s=string)
/**
* @var assoc array of passed arguments
*/
var $ma_arguments;
/**
* Constructor
*/
function bmc_html_tag_functions()
{
$this->init();
}
function init()
{
$this->ma_arguments = array();
}
/**
* Checks if the given key or index exists in the array (PHP < 4.1.0)
*
* @param $ps_key Key to check against
* @param $pa_search Array of elements
* @return true if key is in array
* @access private
*/
function key_exists($ps_key)
{
if ( in_array($ps_key, array_keys($this->ma_arguments)) ) {
return true;
} else {
return false;
}
}
Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM