I have a weird issue, I have had this issue before but I can't remember how I solved it. I have this code,
[syntax=php]$this->test = $library["example"];
// test is now an array containing some information
// set key to test
$this->key = "test";
// $items[0] is set to "example"
print_r($this->key[$items[0]]);
[/syntax]
But this does not work, it gives me this error
Warning: Illegal string offset 'example' in C:\wwwroot\EXP\core\class\char.class.php on line 89
t
Notice the trailing "t" at the end of the warning? That is always the first letter of the key, if I change the key to "xp" it gives me "x".
But if I change it to this, then it works.
[syntax=php]
print_r($this->test[$items[0]]);
[/syntax]
How do I solve this?
Using array value as key, only the first letter.
Re: Using array value as key, only the first letter.
Solved.
I by mistake set the variable to a string instead of a variable >_>
I by mistake set the variable to a string instead of a variable >_>