I am having a few issues with an array being brought from a database.
The original array once converted looks like this:
Array
(
[0] => {"lastTimeSave":"1494000000"
[1] => "rankexpire":"0"
[2] => "evocity_rank":"g-vip"
[3] => "evocity_rankexpire":"0"}
)
I successfully removed some unuseful characters so my final array looks like this:
Array
(
[0] => lastTimeSave:1494000000
[1] => rankexpire:0
[2] => evocity_rank:g-vip
[3] => evocity_rankexpire:0
)
What I am wanting to do is get everything before the ':' and place it into the key of the array, then remove the ':' so it looks something like this:
Array
(
['lastTimeSave'] => 1494000000
['rankexpire'] => 0
['evocity_rank'] => g-vip
['evocity_rankexpire'] => 0
)
I am separating using:
$staffarray = str_replace('"', "", $staffarray);
$staffarray = str_replace('{', "", $staffarray);
$staffarray = str_replace('}', "", $staffarray);
I have already tried multiple things, including:
foreach ($stafftestarray as $key => $value) {
$substring = substr($value, 0, strpos($value, ';'));
$subsubstring = str_replace($substring, "", $value);
$value = $subsubstring;
}
However nothing seems to change it and the output is not being changed, I would really appreciate any help I can get with this problem as I have searched for countless hours how to fix it to no avail.