<?php
//initialization of an element of GLOBALS
$GLOBALS['categories'] = array(1=>'z',2=>'x',3=>'c',4=>'v',5=>'r');
print_r($GLOBALS['categories']);
//another element
$GLOBALS['videos'] = array(1=>'a',2=>'b',3=>'c',4=>'d');
//some operations
$videosCategories =
array(1=>array(2,3,4,5),2=>array(12,13,14,15),3=>array(22,23,24,25),4=>array(32,33,34,35));
foreach($videosCategories as $videoId => $categories2)
$GLOBALS['videos'][$videoId]['category'] = implode(',',$categories2);
//the initial element is reqritten
print_r($GLOBALS['categories']);