3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "age1:32,age2:25,age3:52,..."; $count = preg_match_all('/:\K\d+/', $string, $m); echo array_sum($m[0] ?? []) / $count;

preferences:
94.75 ms | 1252 KiB | 5 Q