$arr = [
'/category0/subcat1/subcat2',
'/category0/subcat1/subcat4',
'/category0/subcat5/subcat6',
'/category2/subcat7/subcat8',
'/category2/subcat9/subcat10',
'/category2/subcat11/subcat12',
];
$t = [];
foreach ($arr as $item) {
$s = explode('/', $item);
$i = $s[1];
unset ($s[1], $s[0]);
if (!$t[$i] ){
$t[$i] = [];
}
foreach ($s as $item){
array_push ( $t[$i],$item);
}
}
foreach ($t as &$item){
$item = array_unique($item);
}
echo('<pre>');
var_dump($t);
var_dump(json_encode($t));
echo('<pre>');
$infor = R::find('info', 'server = ? AND name = ?', [$server, $name]);
$infor = R::find('info', 'server = ? AND name = ?', [$server, $name]);
foreach ($infor as $info ){
var_dump($info ->id);
}
$info = R::findOne('info', 'server = ? AND name = ?', [$server, $name]);
var_dump($infr ->id);
var url='test.php';
function i(c) {return document.getElementById(c);}
function new_fetch(post){ return fetch(url, {method: 'POST', body: JSON.stringify(post),}).then(response => response.json())}
function Start() {$post={"ident" : "Player_take", "metod":"agReSortPosition"};
new_fetch($post).then((data) => i('Select_view').innerHTML = data)}
function nextLevel($s_2, $s_1){$post={"ident" : "Player_take_Rebud_test", "metod":{"name":$s_1, "style":$s_2}};
new_fetch($post).then((data) => i('Select_view').innerHTML = data)}
public function takeRebudTest($id){
$config = json_decode(file_get_contents($id->name.'.json'), true);
foreach($config['Player'][$id->style] as $value){
$out[]=$value;
}
return $out;
}