The cycle passes, and you need to add information to the multidimensional array, for example:
name => Riga posY => 54.343434 posY => 57.343425 name => Daugavpils posY => 53.342346 posX => 56.456677
Tried as follows, but retains only the last value in the loop:
$arrPos = array( lat => $markPosY, lng => $markPosX );