3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getOptionOrElse(array $options, string $key, $else = false) { if (key_exists($key, $options) && $options[$key]['value'] !== '' && $options[$key]['value'] !== null) { return $options[$key]['value']; } return $else; } $abo_options = [ 'gedeelde bundel - belminuten per maand' => ['value' => 200], 'gedeelde bundel - sms per maand' => ['value' => 200], 'gedeelde bundel - mb per maand' => ['value' => 200] ]; $minuten_sms_mb_amount = getOptionOrElse($abo_options,'gedeelde bundel - belminuten per maand', 0); $minuten_sms_mb_amount += getOptionOrElse($abo_options,'gedeelde bundel - sms per maand', 0); $minuten_sms_mb_amount += getOptionOrElse($abo_options,'gedeelde bundel - mb per maand', 0); echo "amount: {$minuten_sms_mb_amount}";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j7P5r
function name:  (null)
number of ops:  23
compiled vars:  !0 = $abo_options, !1 = $minuten_sms_mb_amount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'getoptionorelse'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'gedeelde+bundel+-+belminuten+per+maand'
          4        SEND_VAL                                                 0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   19     7        INIT_FCALL                                               'getoptionorelse'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'gedeelde+bundel+-+sms+per+maand'
         10        SEND_VAL                                                 0
         11        DO_FCALL                                      0  $5      
         12        ASSIGN_OP                                     1          !1, $5
   20    13        INIT_FCALL                                               'getoptionorelse'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 'gedeelde+bundel+-+mb+per+maand'
         16        SEND_VAL                                                 0
         17        DO_FCALL                                      0  $7      
         18        ASSIGN_OP                                     1          !1, $7
   22    19        NOP                                                      
         20        FAST_CONCAT                                      ~9      'amount%3A+', !1
         21        ECHO                                                     ~9
         22      > RETURN                                                   1

Function getoptionorelse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 12
filename:       /in/j7P5r
function name:  getOptionOrElse
number of ops:  23
compiled vars:  !0 = $options, !1 = $key, !2 = $else
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
    5     3        INIT_FCALL                                               'key_exists'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7      > JMPZ_EX                                          ~4      $3, ->12
          8    >   FETCH_DIM_R                                      ~5      !0, !1
          9        FETCH_DIM_R                                      ~6      ~5, 'value'
         10        IS_NOT_IDENTICAL                                 ~7      ~6, ''
         11        BOOL                                             ~4      ~7
         12    > > JMPZ_EX                                          ~4      ~4, ->17
         13    >   FETCH_DIM_R                                      ~8      !0, !1
         14        FETCH_DIM_R                                      ~9      ~8, 'value'
         15        TYPE_CHECK                                  1020  ~10     ~9
         16        BOOL                                             ~4      ~10
         17    > > JMPZ                                                     ~4, ->21
    6    18    >   FETCH_DIM_R                                      ~11     !0, !1
         19        FETCH_DIM_R                                      ~12     ~11, 'value'
         20      > RETURN                                                   ~12
    8    21    > > RETURN                                                   !2
    9    22*     > RETURN                                                   null

End of function getoptionorelse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.72 ms | 1403 KiB | 18 Q