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;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cbAsl
function name:  (null)
number of ops:  16
compiled vars:  !0 = $string, !1 = $count, !2 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'age1%3A32%2Cage2%3A25%2Cage3%3A52%2C...'
    4     1        INIT_FCALL                                                   'preg_match_all'
          2        SEND_VAL                                                     '%2F%3A%5CK%5Cd%2B%2F'
          3        SEND_VAR                                                     !0
          4        SEND_REF                                                     !2
          5        DO_ICALL                                             $4      
          6        ASSIGN                                                       !1, $4
    5     7        INIT_FCALL                                                   'array_sum'
          8        FETCH_DIM_IS                                         ~6      !2, 0
          9        COALESCE                                             ~7      ~6
         10        QM_ASSIGN                                            ~7      <array>
         11        SEND_VAL                                                     ~7
         12        DO_ICALL                                             $8      
         13        DIV                                                  ~9      $8, !1
         14        ECHO                                                         ~9
    6    15      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.7 ms | 1879 KiB | 15 Q