Update catsplit.format.php

This commit is contained in:
Namhyeon Go 2019-06-01 14:35:34 +09:00 committed by GitHub
parent a26e285980
commit 25f679f062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,3 +18,26 @@ if(!check_function_exists("catsplit_encode")) {
return sprintf("('%s')<=(%s)", implode("','", $_vs), implode(",", $_ks));
}
}
if(!check_function_exists("catsplit_decode")) {
function casplit_decode($data) {
$s_final = array();
// step 1
$s1 = explode(")<=(", substr($data, 1, -1));
// step 2
$s2a = explode(",", $s1[0]);
$s2b = explode(",", $s1[1]);
// step 3
$s3 = array_combine($s2b, $s2a);
// step 4
foreach($s3 as $k=>$v) {
$s_final[$k] = substr(stripslashes($v), 1, -1);
}
return $s_final;
}
}