<?php
include "inc/config.php";
//fetch and decode
$data = $db->fetch_single_row('sys_system','id',2);
$replace_encode = substr_replace($data->data, '', 3 , 3);
$decode = base64_decode($replace_encode);
$json = json_decode($decode);
foreach ($json as $key => $value) {
	$data_services[$key] = str_replace("premium-update-new-new", "premium-update-new", $value);
}

dump($json);

function stringInsert($str,$insertstr,$pos)
{
    $str = substr($str, 0, $pos) . $insertstr . substr($str, $pos);
    return $str;
}
function ins_data($data_array) {
	global $db;
	$salt = "XZO";
	$dt = json_encode($data_array);
	$encode_json = base64_encode($dt);
	$json_after_salt = stringInsert($encode_json,$salt,3);

	$data = array(
		'data' => $json_after_salt
		);
		$db->update('sys_system',$data,'id',2);
}

dump($data_services);

//ins_data($data_services);