$video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))->save('frame.jpg');
$arr = array(
array(1, 11),
array(1, 12),
array(1, 13),
array(2, 21),
array(2, 22));
$last_key = -1;
foreach ($arr as $a) {
if ($a[0] !== $last_key) {
echo '<br>'.$a[0].': '.$a[1];
$last_key = $a[0];
} else {
echo ', '.$a[1];
}
}
$arr = array(
array(1, 11),
array(1, 12),
array(1, 13),
array(2, 21),
array(2, 22));
function f($o, $i)
{
$o[$i[0]][] = $i[1];
return $o;
}
print_r(array_reduce($arr, 'f'));
Array
(
[1] => Array
(
[0] => 11
[1] => 12
[2] => 13
)
[2] => Array
(
[0] => 21
[1] => 22
)
)
$arr = array(
array('желтые', 'зеленые','синие'),
array('длинные','короткие','узкие'),
array('штаны','шорты','трусы'));
function getVariants($arr) {
$variant = array();
$result = array();
$sizearr = sizeof($arr);
function recursiv($arr, $variant, $level, $result, $sizearr){
$level++;
if($level<$sizearr){
foreach ($arr[$level] as $val){
$variant[$level] = $val;
$result = recursiv($arr, $variant, $level, $result, $sizearr);
}
}else{
$result[] = $variant;
}
return $result;
}
$arrays = recursiv($arr, $variant, -1, $result, $sizearr);
$result = array();
foreach ($arrays as $str) {
$result[] = implode(' ', $str);
}
return $result;
}
print_r(getVariants($arr));
$playlist = file_get_contents('https://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2&alt=json');
$playlist = str_replace('yt$statistics', 'yt_statistics', $playlist);
$playlist = json_decode($playlist);
$entries = $playlist->feed->entry;
$views = 0;
foreach ((array)$entries as $entry) {
$views += $entry->yt_statistics->viewCount;
}
echo $views;
echo $hh?$hh.':'.$mm.':'.$ss:$mm.':'.$ss;