3v4l.org

run code in 300+ PHP versions simultaneously
<?php // rsrq(rb,rsrp,rssi) = 10*log10(rb*10**(rsrp/10)/10**(rssi/10)); function calc ($data) { $pattern = "Freq:([ ]+)(?P<Freq>[0-9\-]+)\n"; $pattern .= "Band:([ ]+)(?P<Band>[0-9\-]+)\n"; $pattern .= "CellId:([ ]+)(?P<CellId>[0-9\-]+)\n"; $pattern .= "RSRP:([ ]+)(?P<RSRP>[0-9\-]+)\n"; $pattern .= "RSRQ:([ ]+)(?P<RSRQ>[0-9\-]+)\n"; $pattern .= "RSSI:([ ]+)(?P<RSSI>[0-9\-]+)"; preg_match('/'.$pattern.'/i', $data, $matches); if (!empty($matches)) { $rb = 50; // lte 800 if ($matches['Band'] == 3) { $rb = 100; // lte 1800 } echo rsrq($rb, $matches['RSRP'], $matches['RSSI']); } } function rsrq ($rb, $rsrp, $rssi) { return 10*log10($rb*10**($rsrp/10)/10**($rssi/10)); } calc(">> Current-LTE-Config << Acgorder: 03 Band: 3FFFFFFF Roam: 3 Srvdomain: 1 LTEBand: 80044 >> Current-CellInfo << Freq: 18150 Band: 3 CellId: 60 RSRP: -88 RSRQ: -6 RSSI: -62");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F8sHW
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'calc'
          1        SEND_VAL                                                 '%3E%3E+Current-LTE-Config+%3C%3C%0AAcgorder%3A+++++++03%0ABand%3A+++++++++++3FFFFFFF%0ARoam%3A+++++++++++3%0ASrvdomain%3A++++++1%0ALTEBand%3A++++++++80044%0A%0A%3E%3E+Current-CellInfo+%3C%3C%0AFreq%3A+++18150%0ABand%3A+++3%0ACellId%3A+60%0ARSRP%3A+++-88%0ARSRQ%3A+++-6%0ARSSI%3A+++-62'
          2        DO_FCALL                                      0          
   40     3      > RETURN                                                   1

Function calc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 32
filename:       /in/F8sHW
function name:  calc
number of ops:  33
compiled vars:  !0 = $data, !1 = $pattern, !2 = $matches, !3 = $rb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, 'Freq%3A%28%5B+%5D%2B%29%28%3FP%3CFreq%3E%5B0-9%5C-%5D%2B%29%0A'
    6     2        ASSIGN_OP                                     8          !1, 'Band%3A%28%5B+%5D%2B%29%28%3FP%3CBand%3E%5B0-9%5C-%5D%2B%29%0A'
    7     3        ASSIGN_OP                                     8          !1, 'CellId%3A%28%5B+%5D%2B%29%28%3FP%3CCellId%3E%5B0-9%5C-%5D%2B%29%0A'
    8     4        ASSIGN_OP                                     8          !1, 'RSRP%3A%28%5B+%5D%2B%29%28%3FP%3CRSRP%3E%5B0-9%5C-%5D%2B%29%0A'
    9     5        ASSIGN_OP                                     8          !1, 'RSRQ%3A%28%5B+%5D%2B%29%28%3FP%3CRSRQ%3E%5B0-9%5C-%5D%2B%29%0A'
   10     6        ASSIGN_OP                                     8          !1, 'RSSI%3A%28%5B+%5D%2B%29%28%3FP%3CRSSI%3E%5B0-9%5C-%5D%2B%29'
   12     7        INIT_FCALL                                               'preg_match'
          8        CONCAT                                           ~10     '%2F', !1
          9        CONCAT                                           ~11     ~10, '%2Fi'
         10        SEND_VAL                                                 ~11
         11        SEND_VAR                                                 !0
         12        SEND_REF                                                 !2
         13        DO_ICALL                                                 
   13    14        ISSET_ISEMPTY_CV                                 ~13     !2
         15        BOOL_NOT                                         ~14     ~13
         16      > JMPZ                                                     ~14, ->32
   14    17    >   ASSIGN                                                   !3, 50
   15    18        FETCH_DIM_R                                      ~16     !2, 'Band'
         19        IS_EQUAL                                                 ~16, 3
         20      > JMPZ                                                     ~17, ->22
   16    21    >   ASSIGN                                                   !3, 100
   19    22    >   INIT_FCALL_BY_NAME                                       'rsrq'
         23        SEND_VAR_EX                                              !3
         24        CHECK_FUNC_ARG                                           
         25        FETCH_DIM_FUNC_ARG                               $19     !2, 'RSRP'
         26        SEND_FUNC_ARG                                            $19
         27        CHECK_FUNC_ARG                                           
         28        FETCH_DIM_FUNC_ARG                               $20     !2, 'RSSI'
         29        SEND_FUNC_ARG                                            $20
         30        DO_FCALL                                      0  $21     
         31        ECHO                                                     $21
   21    32    > > RETURN                                                   null

End of function calc

Function rsrq:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F8sHW
function name:  rsrq
number of ops:  15
compiled vars:  !0 = $rb, !1 = $rsrp, !2 = $rssi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   24     3        INIT_FCALL                                               'log10'
          4        DIV                                              ~3      !1, 10
          5        POW                                              ~4      10, ~3
          6        MUL                                              ~5      !0, ~4
          7        DIV                                              ~6      !2, 10
          8        POW                                              ~7      10, ~6
          9        DIV                                              ~8      ~5, ~7
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        MUL                                              ~10     $9, 10
         13      > RETURN                                                   ~10
   25    14*     > RETURN                                                   null

End of function rsrq

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
231.17 ms | 1407 KiB | 18 Q