$input = [
'111',
'222',
];
$arrays = [
[
'new',
'confirmed'
],
[
'7777',
'XXXX'
]
];
$params = [
'state',
'warehouse'
];
$result = [];
for ($i = 0; $i < count($input); $i++) {
$key = $input[$i];
$result[$key] = [];
for ($j = 0; $j < count($params); $j++) {
$result[$key][$params[$j]] = $arrays[$j][$i];
}
}
print_r($result);
$data = ['type' => 'text', 'code' => $code];
$data = http_build_query($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$data = [ "error" => "0" ];
echo json_encode($data);
$arr1 = [3,4,5,6,7,8];
$arr2 = [10,11,12];
function array_shuffle($a, $b) {
$count = count($b);
$indexes = array_rand($a, $count);
$result = [];
for ($i = 0, $l = count($a); $i < $l; ++$i) {
for ($j = 0; $j < $count; ++$j) {
if ($indexes[$j] === $i) {
$result[] = $b[$j];
break;
}
}
$result[] = $a[$i];
}
return $result;
}
print_r(array_shuffle($arr1, $arr2));
function parseTrack($str) {
[$first_part, $second_part] = explode(' - ', $str);
$first_part = preg_replace('~^\d+\. ?~', '', $first_part);
$artists = preg_split('~ feat\. |,~', $first_part);
$artist = $artists[0];
$feat = array_slice($artists, 1);
preg_match('~^(.*?)(?: \(([^(]+) prod\.?\))?$~', $second_part, $match);
return [
'artist' => $artist,
'feat' => $feat,
'name' => $match[1],
'beatmaker' => isset($match[2]) ? $match[2] : null
];
}
$check = array_filter($arr['info']['reasons'], function($item) {
return $item['reason'] === 'NUMBER 1';
});
if ($check) {
// ...
} else {
// ...
}
preg_match("/(?:\r|\n)[^']*?(#.*?)(?:\r|\n)/", $str, $arr);
var_dump($arr[1]);