<?php $string = "age1:32,age2:25,age3:52,..."; $count = preg_match_all('/:\K\d+/', $string, $m); echo array_sum($m[0] ?? []) / $count;
You have javascript disabled. You will not be able to edit any code.