- array_map: documentation ( source)
- chr: documentation ( source)
- json_encode: documentation ( source)
<?php
$konstanty = array(
267,
51,
162,
131,
389,
71,
59,
164,
285,
5,
20,
100,
94,
224,
245,
121,
2,
234,
236,
342,
78,
33,
35,
3,
68,
2
);
$kostanty = array_map(function ($i) {return $i/3421;}, $konstanty);
$x = [];
foreach ($kostanty as $key => $konstanta) {
$x[chr(ord('A')+$key)] = $konstanta;
}
echo json_encode($x);