I'v recently came accross a problem with some code as shown below:
$key = "upload_8_fid_aids.tmp";
public function to_key($key) {
$s = $this->table;//$s = kv
foreach((array)$key as $k=>$v) {
$s .= '-'.$this->primarykey[$k].'-'.$v;
}
return $s;
}
There's a (array)$key signature out there in the foreach loop,the first thing I'm stucking in is the "array" that prefixed with the variabls $k,what does this mean?The very first idea that hit upon me is that it converts the $k to an array,though,the variable $k is a string,is it plausible to convert string to array in php?I think it is unreasonable.So what does that array mean?
Thanks in advance!